0

为 3000 个 TcpClients 侦听 1 个端口和为 30 个 TcpClients 侦听 100 个端口之间有什么区别。

4

2 回答 2

1

好吧,在您的 TCP 服务器上,您将打开 1 个侦听套接字而不是 100 个。管理 100 个侦听端口会很困难。

TCP 流量将是相同的,因为您在每种情况下都有相同数量的连接,但是管理这么多不同的套接字会产生更多开销。

如果您的目标是分散服务器上的负载,那么创建额外的侦听端口并不是真正的解决方案。

于 2013-03-22T18:02:35.360 回答
0
Thats a bit Correct ,managing so many ports are difficult. but opening single port for so many for eg 1 serversocket for 3000 clients will surely degrade the performance and make lot of delay.

Now if two clients send data simultaneously, server can only process them sequentially. So second client won't get processed until server is done processing with first.
于 2013-03-22T18:11:56.867 回答