socket.setNoDelay([noDelay])


启用或禁用 Nagle 算法的使用。

当TCP 连接被创建时,它会启用 Nagle 算法。

Nagle 算法会延迟数据,然后再通过网络发送数据。 它会尝试以延迟为代价优化吞吐量。

noDelay 传入 true 或不传参数,则会禁用 Nagle 的 socket 算法。 为 noDelay 传入 false 则会启用 Nagle 算法。

Enable/disable the use of Nagle's algorithm.

When a TCP connection is created, it will have Nagle's algorithm enabled.

Nagle's algorithm delays data before it is sent via the network. It attempts to optimize throughput at the expense of latency.

Passing true for noDelay or not passing an argument will disable Nagle's algorithm for the socket. Passing false for noDelay will enable Nagle's algorithm.