TcpClient通过端口分发

时间:2013-03-22 17:54:20

标签: c# port tcpclient tcplistener

对于3000 TcpClients侦听1端口和侦听30个TcpClients的100个端口之间是否有任何区别。

2 个答案:

答案 0 :(得分:1)

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

TCP流量的数量是相同的,因为每个方案中的连接数相同,但是管理这么多不同的套接字会产生更多的开销。

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

答案 1 :(得分: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.