Search code examples
tcpnetwork-programming

Explain how the web server identifies and differentiates among those simultaneous TCP connections


A web server receives several Transmission Control Protocol (TCP) connections from multiple clients simultaneously. Explain how the web server identifies and differentiates among those simultaneous TCP connections


Solution

  • Explain how the web server identifies and differentiates among those simultaneous TCP connections

    Because a TCP connection is identified by two sockets, the local socket with the IP and TCP addresses, and the remote socket with the remote IP and TCP addresses. This is explained in RFC 793, Transmission Control Protocol, the definition for TCP:

    Multiplexing:

    To allow for many processes within a single Host to use TCP communication facilities simultaneously, the TCP provides a set of addresses or ports within each host. Concatenated with the network and host addresses from the internet communication layer, this forms a socket. A pair of sockets uniquely identifies each connection. That is, a socket may be simultaneously used in multiple connections.

    The binding of ports to processes is handled independently by each Host. However, it proves useful to attach frequently used processes (e.g., a "logger" or timesharing service) to fixed sockets which are made known to the public. These services can then be accessed through the known addresses. Establishing and learning the port addresses of other processes may involve more dynamic mechanisms.