When a program tries to connect to a Well Known Port service, it requests a free port from the system. The system randomly generates the port no and give it to program requesting the port no. The default dynamic range is 1024-65535. System can give out the ports available from this range randomly. If system gives out 5000 or above than that then an error will be generated and operation will fail. This is because limitation in the registry for Dynamic Port Rage. By default, Dynamic Port Range is configured from 1024-5000. You may need to change this as per your requirement.
To change this, you need to modify a registry entry as mentioned below:
- KEY Name: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\Parameters
- Entry Name: MaxUserPort
- Type: DWORD
- Value: 65535
Default value is 5000.