Reputation: 13298
Let say I have two processes, both are listening on the port 80 (html) awaiting for an html packet to be unpacked, analyzed and displayed. Now how does the system know which process is the html packet for ? For instance, It seems Skype is listening on the port 80 while another application does too. How does Skype know "this packet is for me ?" and on which network layer that process is happening ?
Upvotes: 0
Views: 21
Reputation: 16286
You can "reuse" a port. When application crashes or exits not closing a socket the system can see the port as still "used", so with this feature you can actually reuse it again. As I know if multiple sockets are listening on the same port, packets will be delivered to them in pseudo-random manner. I don't know if this can be used reliably.
Also port is not a unique system-wide thing, only "port + IP address" is. So multiple applications can safely use the same port if they are bound to different network interfaces.
Upvotes: 1