When running automated tasks on the computer for a long time, it is possible to get Failed to establish a new connection: [WinError 10048]. Usually each socket address (protocol/network address/port) is allowed to be used only once.

You can modify the registry key, to improve the network performance of computer.

Use the regedit command to access HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/TCPIP/Parameters. Registry subkey and create a new REG_DWORD value named TcpTimedWaitDelay. Set this value to decimal 30, which is hexadecimal 0x0000001e. This value sets the wait time to 30 seconds.

Use the regedit command to access HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/TCPIP/Parameters. Registry subkey and create a new REG_DWORD value named MaxUserPort. Stop and restart the system. Default value: None. Recommended value: at least decimal 32768.

Users who do not know how to open the registry can directly create a new TXT document, and write the following content to save it. Change the name of this new file to Tcpip.reg, and double-click to import it into the registry:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
"TcpTimedWaitDelay"=dword:0000001e
"MaxUserPort"=dword:00008000

When the interface is invoked, using the command-line tool netstat -n, finding that nearly 4,000 connections to the IP address of the target computer running the interface are in the TIME_WAIT state , you can increase the default MaxUserPort setting and lower the TcpTimedWaitDelay setting at the same time so that the client anonymous port is not exhausted. For example, you can set MaxUserPort to 20000 and TcpTimedWaitDelay to 30. A lower TcpTimedWaitDelay setting means that the socket waits less time in the TIME_WAIT state. A higher MaxUserPort setting means you can keep more sockets in the TIME_WAIT state.

To ensure client stability, you can restart the client for a period of time:

Call the local port API, GET request this address, to restart and automatically log in to the VMLogin client.

http://127.0.0.1:35000/api/v1/client/restart Restart client (no request parameters).