在 linux 网络套接字服务器机器上,当所有网络端口都分配给客户端时会发生什么

On the linux network socket server machine, what happens when all network ports are allocated for clients

在linux网络套接字服务器机器上,当所有网络端口都分配给客户端时会发生什么?如果发生这种情况,来自客户端的连接请求被拒绝或延迟?如果是这样,认为一台 linux 机器最多可以同时服务于开放端口的数量是否正确? (假设所有其他资源都足够)

If that's right, is it right to think that one linux machine can serve at most the number of open ports simultaneously?

不,端口不是这里的限制因素。 TCP连接的socket其实是一个五元组(src_port, src_address, dest_port, dest_address, protocol)

因此,对于每个侦听一个端口的服务器,每个客户端都可以使用相同的协议进行 ip_local_port_range 连接中设置的任何设置。

但是,您可以解决这个问题 - 如果您有更多的 IP 地址(您可以为此使用 IP 别名,即使您没有多个接口),或者如果您的服务器正在侦听多个一个端口,可能的连接数上升。

资源: