The easiest way to tune TCP under Windows XP is to get
DrTCP from "DSL Reports".
Set the "Tcp Receive Window" to your computed BDP (e.g. 4000000), turn on "Window Scaling"
"Selective Acks", and "Time Stamping".
Other programs that allow you to edit Windows TCP settings include
SG TCP Optimizer and
Cablenut.
To verify the changes, you can use the Windows Registry editor to verify the following:
# turn on window scale and timestamp option
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Tcp1323Opts=3
# set default TCP receive window size
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\TcpWindowSize=256000
# set max TCP send/receive window sizes (max you can set using setsockopt call)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\GlobalMaxTcpWindowSize=16777216
You can use setsockopt() in your program to set your buffers to any size up to GlobalMaxTcpWindowSize,
or you can use TcpWindowSize to set the default send and receive buffers for ALL sockets to this size.
Its probably not a good idea to set this too large, depending on how much memory you have
in your system.
This article contains more information on Windows network tuning
Windows network tuning.
More information is available in the following Microsoft Documents:
TCP Configuration Parameters
TCP/IP Implementation Details
This articles may also be useful:
Windows 2000/XP Registry Tweaks