Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer
...known as sockets ( – user142485 Oct 1 '12 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. – Muhammad Umer Mar 5 '13 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. – RedGrittyBrick Mar 5 '13 at 9:41
THANKS A LOTTTTTTTTTTT – Muhammad Umer Mar 5 '13 at 20:11
@RedGrittyBrick I think the Source port in IP packet is the port assigned by NAT Router, not the OS – onmyway133 Mar 21 '13 at 4:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .