socket.setNoDelay([noDelay])
-
noDelay
<boolean> 默认值:true
¥
noDelay
<boolean> Default:true
-
返回:<net.Socket> 套接字自身
¥Returns: <net.Socket> The socket itself.
启用/禁用 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.
为 noDelay
传递 true
或不传递参数将禁用套接字的 Nagle 算法。为 noDelay
传递 false
将启用 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.