How to ensure NetworkStream to send data immediately without closing the Stream or TcpClient?

℡╲_俬逩灬. 提交于 2019-12-01 12:46:08

Set TcpClient.NoDelay to true so that Nagle's algorithm isn't used.

From the MSDN Library documentation:

When NoDelay is false, a TcpClient does not send a packet over the network until it has collected a significant amount of outgoing data. Because of the amount of overhead in a TCP segment, sending small amounts of data is inefficient. However, situations do exist where you need to send very small amounts of data or expect immediate responses from each packet you send. Your decision should weigh the relative importance of network efficiency versus application requirements.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!