Share via


IPPROTO_TCP (Compact 2013)

3/26/2014

The following table describes IPPROTO_TCP Socket Options. IPPROTO_TCP is documented for backward compatibility with Winsock 1.1. See getsockopt and setsockopt for more information on getting and setting socket options. To enumerate protocols and discover supported properties for each installed protocol, use the WSAEnumProtocols function.

Some socket options require more explanation than these tables can convey; such options contain links to additional pages.

IPPROTO_TCP

Option

get/set

Optval Type

Description

TCP_NODELAY

both

BOOL

Enables or disables the Nagle algorithm for TCP sockets. Enabled by default. The Nagle algorithm is disabled if the TCP_NODELAY option is enabled, and the reverse is true as well.

Note

Application writers should not set TCP_NODELAY unless the impact of doing so is well understood and desired because setting TCP_NODELAY can have a significant negative impact on network and application performance.

The Nagle algorithm (described in RFC 896) is effective in reducing the number of small packets sent by a host. The process involves buffering send data when there is unacknowledged data already in flight, or buffering send data until a full-size packet can be sent. It is highly recommended that Windows Sockets implementations enable the Nagle Algorithm by default because the algorithm can deliver significant performance enhancements. However, for applications where many small messages are sent, and the time delays between the messages are maintained, this algorithm can impede performance. In this case, setsockopt with TCP_NODELAY can be used to turn it off.

Note

TCP packets might not be sent immediately even if the TCP_NODELAY socket option is set. To make the TCP stack immediately send packets in addition to setting the TCP_NODELAY socket option you might also have to set the EnhanceTCPSend registry value at "HKEY_LOCAL_MACHINE\Comm\Tcpip\Parms" to "0".
The EnhanceTCPSend registry value is documented in KB article 973144.

See Also

Reference

Socket Options