Which is the default TCP connect timeout in Windows? There is a registry key to configure it or it's set dynamically?
In Windows the value is dynamic for established conections, though the default for initial connections is 72 seconds. The Registry settings are defined in this article:
HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services: \Tcpip \Parameters
TcpInitialRTT: Defines what the initial time-out settings are for new connections. This number in seconds is doubled each time it retransmits before timing a connection out. Defaults to 3.
TcpMaxConnectRetransmissions: Defines the number of retransmissions before timing a connection out. Defaults to 5.
Usually "connect timeout" refers to the timeout for creating the initial connection to a host. In many systems (Windows 7 included), this value is configured using separate settings from timeouts for ongoing communications after a connection has been established. This answer addresses the "initial connect" scenario for Windows 7, which is different from XP.
For Windows 7, two hotfixes are required to support adjusting connect timeout settings. The new settings can be configured with the 'netsh' command.
From the 2786464 hotfix article:
The first hotfix adds a 'MaxSynRetransmissions' setting which allows changing the retry setting from the default value of 2. The second adds 'InitialRto' setting which allows changing the Initial RTO value from the default of 3000ms (yes, milliseconds), but only to something shorter than 3000ms; it cannot be increased. Depending on your situation, you may only need the 'MaxSynRetransmissions' hotfix.
Install both hotfixes, reboot, then open a command window as Administrator. Further reboots are not required for subsequent netsh command invocations.
Note: Windows telnet is used for the reference for actual connection timeout. It needs to be installed separately, but is easy to do.
Additional links / kudos:
TcpInitialRTT and TcpMaxConnectRetransmissions may not be present in Vista and Windows 2008. This Microsoft document does not include them. http://download.microsoft.com/download/c/2/6/c26893a6-46c7-4b5c-b287-830216597340/TCPIP_Reg.doc
And this says at least TcpInitialRTT is gone, although I don't know how reliable it is. http://pul.se/Blog-Post-TCP-IP-Stack-hardening-in-Operating-Systems-starting-with-Windows-Vista_SharePoint-kHPTTCP0WJ5,7zq00hH0wINE
If I understand your question correctly, you are referring to:
This key determines the time that must elapse before TCP/IP can release a closed connection and reuse its resources. This interval between closure and release is known as the TIME_WAIT state or twice the maximum segment lifetime (2MSL) state. During this time, reopening the connection to the client and server costs less than establishing a new connection. By reducing the value of this entry, TCP/IP can release closed connections faster and provide more resources for new connections. Adjust this parameter if the running application requires rapid release, the creation of new connections, or an adjustment because of a low throughput caused by multiple connections in the TIME_WAIT state.
The exact key is: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Tcpip\Parameters\TcpTimedWaitDelay
You may not have it set if you are using Win2008 or later, but the default is 240 decimal (240 seconds or 4 minutes that is). You can add the key to the registry with a different value and it will take effect after a reboot (tested on Windows Server 2008R2 in a production environment). This is an absurdly high value given the quality of modern networks.
I had an application literally less than a month ago running on a server that exhausted the maximum number of connections Windows can support and killed every network service on that server regularly. 16,000+ connections in netstat -a when you even manage to RDP to the server. We set the value to 30 decimal (30 seconds) and voila, the issue was solved - less than 10,000 simultaneous connections (since the app was rapidly opening and closing them) and no throughput issues.