TCP Receive Window Size and Window Scaling
The Transmission Control Protocol (TCP) receive window size is the maximum amount of received data, in bytes, that can be buffered at one time on the receiving side of a connection. The sending host can send only that amount of data before waiting for an acknowledgment and window update from the receiving host.
Working with Receive Window Size in Windows TCP/IP
In Windows Server 2003, Windows XP, and Windows 2000, the Transmission Control Protocol/Internet Protocol (TCP/IP) stack tunes itself in most environments, using larger default window sizes than in earlier versions of Windows. Instead of using a hard-coded default receive window size, TCP as implemented in Windows Server 2003 adjusts the window size to even increments of the maximum segment size (MSS) negotiated during connection setup. Matching the receive window to even increments of the MSS increases the percentage of full-sized TCP segments used during bulk data transmission and thus helps minimize the number of segments sent when large sets of data are transmitted.
The default receive window size that TCP advertises in Windows Server 2003 depends on the following, in order of precedence:
- The value for the SO_RCVBUF Windows Sockets option for the connection. This option specifies the total per-socket buffer space reserved for receive operations.
- The per-interface TcpWindowSize registry value.
- The GlobalMaxTcpWindowSize registry value.
Note For more information about the TcpWindowSize and GlobalMaxTcpWindowSize registry values, see the Windows Server 2003 Resource Kit documentation. To locate this documentation, see "Windows Deployment and Resource Kits" at http://www.microsoft.com/windows/reskits/default.asp.
- Autodetermination based on the bit rate of the transmission media, as reported by the network.
If none of the preceding sets the window size, the default receive window size is set as follows:
- For a transmission below 1 megabit per second (Mbps), 8 KB.
- For a 1–100 Mbps transmission, 17 KB.
- For a transmission greater than 100 Mbps, 64 KB.
Note For 10 and 100 Mbps Ethernet connections, the receive window is usually set to 17,520 bytes (17 KB rounded up to 12 1460-byte segments).
Working with Window Scaling in Windows TCP/IP
The TCP/IP standard allows for a receive window up to 65,535 octets in size, which is the maximum value that can be specified in the 16-bit TCP window size field. To improve performance on high-bandwidth, high-delay networks, Windows TCP/IP supports the ability to advertise receive window sizes larger than 65,535 octets, by using scalable windows as described in RFC 1323. Using window scaling, hosts in a conversation can negotiate a window size that allows multiple large packets, such as those often used in file transfer protocols, to be pending in the receiver's buffers.
RFC 1323 details a method for supporting larger receive window sizes by allowing TCP to negotiate a scaling factor for the window size at connection establishment. The Window Scale TCP header option enables the programmer to set an option called the shift count, which indicates how many bits to the left to shift the value in the window size field, to arrive at the actual window size. For example, a shift count of 1 shifts the stated window size value once to the left, in effect multiplying it by two (2^1). A shift count of 5 multiplies the stated window size by 32 (2^5). This method allows for an actual receive window of up to 1 gigabyte.
TCP window scaling is negotiated on demand in Windows Server 2003, based on the value set for the SO_RCVBUF Windows Sockets option when a connection is initiated. Additionally, the Window Scale option is used by default on a connection if the received SYN segment for that connection as initiated by a TCP peer contains the Window Scale option. Windows Server 2003 TCP does not initiate connections with window scaling by default. To instruct the Windows Server 2003 TCP stack to attempt to negotiate a larger receive window size by making use of the Window Scale option, set the Tcp1323Opts registry value to 1.
For more information on RFC 1323, see http://www.ietf.org/rfc/rfc1323.txt?number=1323.
Setting the Receive Window Size to a Specific Value
Two methods can be used to set the receive window size to a specific value:
- Setting the TcpWindowSize registry value.
- Calling the Windows Sockets function setsockopt, which sets the receive window on a per-socket basis.
If an application generally always requires the same receive window size any time it is run on a particular computer, or if the application's source code is not available, the window size might be best set using the registry. If, on the other hand, the application connects to many different communication partners whose traffic patterns and thus most efficient receive window sizes differ, it might be advisable to calculate and set the windows size programmatically with setsockopt.
TcpWindowSize
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\ interface-name
Data type | Range | Default value |
REG_DWORD |
0x0–0x3FFFFFFF ( bytes ) |
(See description.) |
Description
Determines the largest TCP receive window that the system offers. The receive window is the number of bytes a sender can transmit without receiving an acknowledgment. This entry overrides TCP's negotiated maximum receive window size and replaces it with the value of this entry.
TCP uses a receive window that is four times the size of the maximum TCP segment size (MSS) negotiated during connection setup, up to a maximum size of 64 KB. TCP for Windows 2000 also supports windows scaling, as detailed in RFC 1323, TCP Extensions for High Performance. Scaling enables TCP to provide a receive window of up to 1 GB.
For Ethernet networks, the default value of this entry is 0x4470 (17,520, or 12 segments of 1,460 bytes each). For other networks, the default value is 0xFFFF (65,535) unless 0xFFFF is larger than:
• |
Four times the maximum TCP data size on the network; and |
• |
0x2000 (8,192) rounded up to an even multiple of the network TCP data size. |

Note
This entry determines the maximum receive window size for this interface. When configuring this interface, this entry takes precedence over the GlobalMaxTcpWindowSize entry, which establishes a maximum window size for all interfaces.
Windows 2000 automatically uses windows scaling if the value of this entry is greater than 64 KB. To disable windows scaling, set the value of the Tcp1323Opts entry to 0 or 2.
Windows 2000 does not add this entry to the registry. You can add it by editing the registry or by using a program that edits the registry.
Related Entries


GlobalMaxTcpWindowSize
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Data type | Range | Default value |
---|---|---|
REG_DWORD | 0x0–0x3FFFFFFF (bytes) | (See description.) |
Description
Determines the largest TCP receive window that the system offers. The receive window is the number of bytes a sender can transmit without receiving an acknowledgment. This entry takes precedence over TCP's negotiated maximum receive window size.
TCP uses a receive window that is four times the size of the maximum TCP segment size (MSS) negotiated during connection setup, up to a maximum size of 64 KB. TCP for Windows 2000 also supports windows scaling, as detailed in RFC 1323, TCP Extensions for High Performance. Scaling enables TCP to provide a receive window of up to 1 GB.
For Ethernet networks, the default value of this entry is 0x4470 (17,520, or 12 segments of 1,460 bytes each). For other networks, the default value is 0xFFFF (65,535), unless 0xFFFF is larger than each of the following:
- Four times the maximum TCP data size on the network.
- 0x2000 (8,192), rounded up to an even multiple of the network TCP data size.

This entry determines the default maximum receive window size for all interfaces. When configuring any particular interface, the value of the TcpWindowSize entry for that interface takes precedence over the value of this entry.
Windows 2000 does not add this entry to the registry. You can add it by editing the registry or by using a program that edits the registry.
Tcp1323Opts
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
Data type | Range | Default value |
REG_DWORD |
0 | 1 | 2 | 3 |
3 |
Description
Determines whether TCP uses the timestamping and window scaling features described in RFC 1323, TCP Extensions for High Performance.
Window scaling permits TCP to negotiate a scaling factor for the TCP receive window size, allowing for a very large TCP receive window of up to 1 GB. The TCP receive window is the amount of data the sending host can send at one time on a connection.
Timestamps help TCP measure round trip time (RTT) accurately in order to adjust retransmission timeouts. The Timestamps option provides two timestamp fields of 4 bytes each in the TCP header, one to record the time the initial transmission is sent and one to record the time on the remote host.
This entry is a 2-bit bitmask. The lower bit determines whether scaling is enabled; the higher bit determines whether timestamps are enabled. To enable a feature, set the bit representing the feature to 1. To disable a feature, set its bit to 0.
Value | Meaning |
0 (00) |
Timestamps and window scaling are disabled. |
1 (01) |
Window scaling is enabled. |
2 (10) |
Timestamps are enabled. |
3 (11) |
Timestamps and window scaling are enabled. |

Windows 2000 does not add this entry to the registry. You can add it by editing the registry or by using a program that edits the registry.

For more information about RFC 1323, see the Request for Comments (RFC) link on the Web Resources page.