Windows limitation on number of simultaneously opened sockets/connections per machine

后端 未结 4 1754
青春惊慌失措
青春惊慌失措 2021-01-03 06:04

Let\'s say I have Windows 7 with one real network interface and few loopback interfaces. I have IOCP enabled server that accepts connections from clients. I\'m trying to sim

4条回答
  •  春和景丽
    2021-01-03 06:16

    I have found on some Microsoft page that:

    ... HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\MaxUserPort registry subkey is defined as the maximum port up to which ports may be allocated for wildcard binds. The value of the MaxUserPort registry entry defines the dynamic port range...

    So, if I force the endpoint to use a certain port, e.g.

    IPEndPoint bindEndpoint = new IPEndPoint(IPAddress.Parse(args[0]), 54321);
    

    Then I can open more than 64K simultaneous sockets in the system.

提交回复
热议问题