Why does a web server listening on port 80 not get confused with many packets coming from different hosts. Why does it not confuse packets coming from the same host when different browsers access the server simultaneously?

1 Answer 1


Because the packets have a source IP-address and a Source port - together these uniquely identify each connection

When your two browsers on one PC want to fetch a URL they ask the operating system (OS) to set up a connection, The OS chooses a random source-port address for each connection.

  • ...known as sockets (en.wikipedia.org/wiki/Network_socket).
    – user142485
    Oct 1, 2012 at 16:53
  • so source port and port are different things here. Like httpserver runs on port 80. but it can still receive things on different source ports. Mar 5, 2013 at 4:26
  • @Muhammad: A port can act as either a source port (sending packets) or a destination-port (receiving them). A TCP connection has source-ports and destination-ports. A server receives requests on destination ports. Each service on the server binds to and listens on one or more pre-specified destination-ports. Each destination-port that is in use is allocated to a single specific service. When the server replies (through an established TCP connection) the port roles are reversed. Mar 5, 2013 at 9:41
  • @RedGrittyBrick I think the Source port in IP packet is the port assigned by NAT Router, not the OS
    – onmyway133
    Mar 21, 2013 at 4:22
  • @entropy: It depends where the packet is in it's journey, and whether any routers use NAT (which is common nowadays at edge routers but not required if you have sufficient IP-addresses allocated to you). You could also consider the effects of proxies etc but these are details that don't clarify the main point of the question. Mar 21, 2013 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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