阅读以下文章:10M concurrent websockets
因此,有 1000 个 websocket 服务器在端口 10000-11000 上监听。当与这些服务器之一建立连接时,我假设它们继续从随机建立的带有随机端口的 TCP 连接进行通信。那么,一个IP,64K的端口,怎么维持10M的连接呢?连接是否由 IP 端口对识别?是否可以建立从不同 IP 到同一端口的两个不同连接?这是如何工作的?
最佳答案
When a connection is made to one of these servers, I assume they continue communication from a random established TCP connection with random ports.
错误的假设。他们使用正在监听的同一本地端口号与客户端通信。
So, as one IP is used, and there are 64K ports, how can one maintain 10M connections?
没问题。
Are connections identified by IP-Port pairs?
是的。
Can two different connections from different IPs to same port be established?
是的。
How does this work under the hood?
见上文。 IP:端口对。您回答了自己的问题。
关于linux - 在单个 IP 上维护超过 65535 个连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36172875/