3

I read following line from port WIKI

So, does it mean that same port, let's say 7001 can be bind to a different IP address or different protocol?

As per my knowledge, it cannot be and would result in "port already in use". But want to confirm.

Common application failures, sometimes called port conflicts, occur when multiple programs attempt to bind to the same port numbers on the same IP address using the same protocol.

4

It may help if you think of the port as an extension of the IP address. Just as two different buildings may have a room 101, the rooms are not the same room.

10.1.2.3:1234 is a different port than 172.16.17.18:1234. The function of the port may be the same across IP addresses or protocols (e.g., IPv6 ports have the same functions as IPv4 ports, even though they are different protocols).

| improve this answer | |
  • 1
    Thanks, good analogy and answer. So, if I understand you correct then I can start 2 applications listening on different IP addresses but same port? Are you really sure about this? Because I doubt that I can start 2 application servers lets say Weblogic and Jboss/Wildfly for different IP addresses but same port. – hagrawal Aug 16 '15 at 21:29
  • Also, when it is said that "Ports are logical constructs which identifies a service or process" then what is service or process means there? It means protocol like HTTP, FTP etc. or software applications which are configured to listen on that port? – hagrawal Aug 16 '15 at 21:39
  • 3
    Yes. The port is bound to the IP address by the application. If the combination of IP address and port are already taken, you get an error, but if the applications are using different IP addresses, there is no conflict. To make it a little more complex, it's really the layer-3 (IP or other protocol) address and layer-4 (TCP, UDP, or other protocol) port number. With two IP addresses, you could have four applications using the same port number (2 addresses, each with the same port number for both UDP and TCP). You seen to think the IP address binds to the port, but it's the other way around. – Ron Maupin Aug 16 '15 at 21:44
  • Thank you for your inputs. Few more questions please then I think I can mark it as answered. (1.) When it is said that "Ports are logical constructs which identifies a service or process" then what is service or process means there? It means protocol like HTTP, FTP etc. or software applications which are configured to listen on that port? (2.) When it is said that application is listening on so and so... then does it listen for request to an IP address or a port, or listens on a combination of port and IP address? – hagrawal Aug 16 '15 at 21:54
  • 1
    By service or process, it really means the software service or process like an application. For instance, web servers use HTTP, and the standard HTTP port is TCP port 80. The webserver can be set to use a different port, but, unless you set the browser to try the different port, it won't work. The application uses the address/port combination to listen to. It sets up that combination in the protocol stack, reserving it for itself until it releases it. You should take this line of questioning over to Stack Overflow since this is really into programming for network applications. – Ron Maupin Aug 16 '15 at 22:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.