TIME_WAITs in Netstat report

TIME_WAITs in Netstat report

ISSUE

When I run a netstat, I see most of the connections to our UW server are in TIME_WAIT status.  How can I get those to close and open ports for connection again?


SOLUTION


By default the TCP Timed Wait Delay is 240 seconds.  When you find that your connections are tying up the ports/sockets and preventing further connections, you can configure the Timed Wait Delay to close more quickly.

By default the number of dynamic ports available to TCP/IP applications is limited to 5000.

Reducing the TCP Timed Wait Delay will remove the high number of ports in TIME_WAIT status, by returning the ports to use faster.  increasing the number of available dynamic ports, increase the total number of ports available for user connections

Both values can be increased by adding some entries to the Windows Registry:


Use the regedit command to access the following key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters


Create the following REG_DWORD values, if they do not already exist.  Adjust the value data to match what is below, if the REG_DWORD values already exist.
  1. Value: TcpTimedWaitDelay
    Data Type: REG_DWORD
    Value data: 30 (decimal)

  2. Value: MaxUserPort
    Data Type: REG_DWORD
    Value data: 65534 (decimal)