(I originally posted a similar question on StackOverflow but readers recommended I post here instead)

When you create outgoing TCP connections, most applications let the operating system choose which port to use. Most OSes use the IANA recommended dynamic port range of 49152-65535 for this purpose. But in Windows 2003 and earlier (including XP) Microsoft uses ports 1025-5000. Microsoft lets you change the high end of this range via the MaxUserPort TcpIP registry setting, but I see no way to change the low end. I need to have port 4160 free for incoming connections and on rare occasions an outgoing connection steals that port from me before I bind that port.

  • I am not aware of any way to get around this. Upgrade to vista/2003 or higher (which has a less broken TCP/IP stack), or avoid using the 1025-5000 range. If that is not an option push the MaxUserPort up to limit how often you end up with a conflict and try until you get the port. – pehrs Apr 13 '10 at 15:29

In addition to MaxUserPort, you also need to specify ReservedPorts.

Registry Key: HKLM\System\CurrentControlSet\Services\TCPIP\Parameters

Registry Value: ReservedPorts Type: Multi-string value Value data: 1024-5000

You may also want to try only specifying 4160-4160 and not using ReservedPorts.

  • Thanks, I saw that but I had not realized that you could specify more than one range. Looking deeper, I see you can set multiple ranges by separating with spaces, e.g. "1433-1434 4160-4160" – Chris Dolan Apr 13 '10 at 16:41
  • do we need to change reservedports for windows 8.1 to increase maxuserports? – MonsterMMORPG Mar 20 '17 at 19:02

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.