解释 Web 服务器如何识别和区分那些同时发生的 TCP 连接

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

Web 服务器收到多个传输控制协议 (TCP) 连接 同时来自多个客户端。解释网络服务器如何识别和 区分那些同时发生的 TCP 连接

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

因为 TCP 连接由两个套接字标识,本地套接字具有 IP 和 TCP 地址,远程套接字具有远程 IP 和 TCP 地址。这在 RFC 793, Transmission Control Protocol 中有解释,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.