Max Outgoing Socket Connections in .NET/Windows Server

后端 未结 2 440
隐瞒了意图╮
隐瞒了意图╮ 2021-02-01 09:35

I have a slightly unusual situation where I\'m needing to maintain CLIENT tcp connections to another server for thousands of mobile users on my servers (basically the mobile dev

2条回答
  •  礼貌的吻别
    2021-02-01 10:00

    65355 is a limit of the IP protocol and more importantly is the limit the TCP/IP stacks of most operating systems impose.

    To increase the maximum number of ephemeral ports on Windows, follow these steps:

    1. Start Registry Editor.
    2. Locate the following subkey in the registry, and then click Parameters: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
    3. 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.

    Normally to scale to more than 65K ports you would use multiple servers in a cluster.

提交回复
热议问题