Tuesday, May 12, 2009

Change default setting of TCP ports allowed in Windows

This happens again so that it maybe a good time to record it here.

If you try to set up TCP connections from ports that are greater than 5000, the local computer responds with the following WSAENOBUFS (10055) error message:

An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.

The default maximum number of ephemeral TCP ports is 5000,
To increase the maximum number of ephemeral ports, follow these steps:

Start Registry Editor.
Locate the following subkey in the registry, and then click Parameters:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
On the Edit menu, click New, and then add the following registry entry:
Value Name: MaxUserPort
Value Type: DWORD
Value data: 65534
Valid Range: 5000-65534 (decimal)
Default: 0x1388 (5000 decimal)

Description: This parameter controls the maximum port number that is used when a program requests any available user port from the system. Typically , ephemeral (short-lived) ports are allocated between the values of 1024 and 5000 inclusive.

Exit Registry Editor, and then restart the computer.

Note: An additional TCPTimedWaitDelay registry parameter determines how long a closed port waits until the closed port can be reused.

No comments: