The operation on the socket cannot be performed due to insufficient system buffer space or the queue is full.

Recently, the server's Socket proxy often reports errors, and the error content returned by the client is as follows:

System.Net.Sockets.SocketException: The operation cannot be performed on the socket due to insufficient system buffer space or the queue is full. 172.20.200.56:41596

So I immediately checked the reasons online and finally summarized:

By default, there are only 5000 available ports. After each binding, it takes 120 seconds by default to resume use.
Therefore, because the proxy software forwards a large number of requests, it is so frequent that this problem occurs.

The solution is simple:

1: Modify the default number of available ports: Add a new item
in the registry: HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters : MaxUserPort corresponding value: about 60,000 is OK.

Looking at the word MaxUserPort, I wonder if the author made a typo and whether it is MaxUsePort. After many searches, I still found that there are more of the former, so I estimate that it should be "maximum user port" rather than "maximum used port"

2: Modify the recovery time of the interval: Add a new item
in the registry: HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters : TcpTimedWaitDelay corresponding value: about 10s.

It should be noted that after modifying the registry, you need to restart it for it to take effect.

Guess you like

Origin blog.csdn.net/liuhuanping/article/details/130981171