The TCP_NODELAY option disables the Nagle algorithm. The Nagle algorithm is used to reduce the number of small packets sent by a host by buffering unacknowledged send data until a full-size packet can be sent.msdn中所述,当enable the Nagle algorithm(default),会缓冲数据直到一个full-size packet,那么这个full-size为多大呢?我平时开发时,一个小包,几个字节也是可以立即发出去的,怎么没有感到什么缓冲、延时啊,不大理解,请教了谢谢

解决方案 »

  1.   

    TCP/IP协议不是卷一就是卷二中有相关介绍;
      

  2.   

    Nagle算法是:如果发送方发送小的数据报时,没有收到上一次发送的应答,那么将暂时缓冲这个数据。
    如果你在局域网内测试你的程序,因为网络速度很快,你每次发送的数据都可以很快得到应答,因此你的数据每次都可以马上发送。
    如果你的网络足够慢,在上次发送的数据没有的到应答前,你再次发送小的数据包,你应该可以看到Nagle算法发生作用。