0

Im new to this discipline, so please just dont blast me.

I have Apache in localhost.

localhost:8080

Is it correct to say that 8080 is the port used to comunicate beetween client and server ? What happens if a want to use a port that is already used by another server-client process ?

Poiera
  • 101
  • 1
    you can run only one service with one port. So if your port is already consumed by other service it will not allow you to start the second service you are trying to configure. – Sunil Bhoi Jan 08 '18 at 11:25
  • Using a port the server can comunicate with the client and the client with the server ? – Poiera Jan 08 '18 at 11:27
  • If, for instance, you wanted to use port 80 but it is in use, your options would be to move all hosted web applications under one web server (in this instance apache) or to add an additional IP address to your server and listen to port 80 with apache on this IP only (while also configuring the other web server to listen only on the original IP). – Alex Berry Jan 08 '18 at 12:51
  • @Poiera, yes using a port, that allows client and server communications (traffic) to flow to and from the computer. However if you use local host only the computer itself can talk as `localhost = 127.0.0.1`. Additionally you can have one server program connected to the port at one time. E.G. You can have only one apache instance on that `8080` then your second apache instance would use `8081` and so on because they cannot share the port. – Elliot Huffman Jan 08 '18 at 13:01

1 Answers1

0

It depends on whether you and the other port are setting up for incoming or outgoing connections.

"Connect to" typically means that you're setting up an outgoing connection to the destination port. In that case, if the port is local and the program using the port is using it to listen for incoming connections, you've just made a connection to that program. Whether you can make sense of any data it might send or not is your problem.

If the other program is also using its port for an outgoing connection, your connection attempt will fail and you will typically get an "address/port already in use" error message.

If you are setting up a port for listening for incoming connections, and the port is already in use, your attempt will also fail with an "address/port already in use" error.

telcoM
  • 4,153
  • 12
  • 23