socket.setNoDelay([noDelay])
noDelay<boolean> 默认值:true- 返回:<net.Socket> 套接字本身。
启用/禁用 Nagle 算法的使用。
🌐 Enable/disable the use of Nagle's algorithm.
创建 TCP 连接时,它将启用 Nagle 算法。
🌐 When a TCP connection is created, it will have Nagle's algorithm enabled.
Nagle 算法会在数据通过网络发送前进行延迟。它试图以牺牲延迟为代价来优化吞吐量。
🌐 Nagle's algorithm delays data before it is sent via the network. It attempts to optimize throughput at the expense of latency.
将 true 传递给 noDelay 或不传递参数将会禁用该套接字的 Nagle 算法。将 false 传递给 noDelay 则会启用 Nagle 算法。
🌐 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.