{"id":280,"date":"2022-11-10T10:20:31","date_gmt":"2022-11-10T02:20:31","guid":{"rendered":"https:\/\/vmlogin.us\/help\/?p=280"},"modified":"2023-02-03T14:39:08","modified_gmt":"2023-02-03T06:39:08","slug":"optimize-the-network-improve-wins-long-term-automation-and-stability","status":"publish","type":"post","link":"https:\/\/www.vmlogin.us\/help\/api\/optimize-the-network.html","title":{"rendered":"Optimize the Network, Improve Win's Long Term Automation and Stability"},"content":{"rendered":"\n<p class=\"has-medium-font-size\">1. When running automated tasks on the computer for a long time, it is possible to get <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">\"Failed to establish a new connection: [WinError 10048]\"<\/mark>. Usually each socket address (protocol\/network address\/port) is allowed to be used only once.<br><br><\/p>\n\n\n\n<p class=\"has-medium-font-size\">2. You can modify the registry key, to improve the network performance of computer.<br><br><\/p>\n\n\n\n<p class=\"has-medium-font-size\">3. Use the<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"> regedit<\/mark> command to access <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">HKEY_LOCAL_MACHINE\/SYSTEM\/CurrentControlSet\/Services\/TCPIP\/Parameters<\/mark>. Registry subkey and create a new<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-green-cyan-color\"> <\/mark><\/strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">REG_DWORD<\/mark><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"> <\/mark><\/strong>value named <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">TcpTimedWaitDelay<\/mark>. Set this value to decimal 30, which is hexadecimal 0x0000001e. This value sets the wait time to 30 seconds.<br><br><\/p>\n\n\n\n<p class=\"has-medium-font-size\">4. Use the<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><strong> <\/strong><\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">regedit <\/mark>command to access   <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">HKEY_LOCAL_MACHINE\/SYSTEM\/CurrentControlSet\/Services\/TCPIP\/Parameters<\/mark>. Registry subkey and create a new <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">REG_DWORD<\/mark> value named <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">MaxUserPort<\/mark>. Stop and restart the system. Default value: None. Recommended value: at least decimal 32768.<br><br><\/p>\n\n\n\n<p class=\"has-medium-font-size\">5. 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:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Windows Registry Editor Version 5.00\n\n&#91;HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters]\n\"TcpTimedWaitDelay\"=dword:0000001e\n\"MaxUserPort\"=dword:00008000<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size\"><br><br><\/p>\n\n\n\n<p class=\"has-medium-font-size\">6. When the interface is invoked, using the command-line tool <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">netstat -n<\/mark>, finding that nearly 4,000 connections to the IP address of the target computer running the interface are in the<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"><strong> <\/strong>TIME_WAIT<\/mark> state , you can increase the default <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">MaxUserPort <\/mark>setting and lower the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">TcpTimedWaitDelay<\/mark><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"> <\/mark><\/strong>setting at the same time so that the client anonymous port is not exhausted. For example, you can set <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">MaxUserPort <\/mark>to 20000 and<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"> TcpTimedWaitDelay <\/mark>to 30. <br><br><\/p>\n\n\n\n<p class=\"has-medium-font-size\">7. A lower<strong> <\/strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">TcpTimedWaitDelay<\/mark> setting means that the socket waits less time in the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">TIME_WAIT<\/mark> state. A higher <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-black-color\">MaxUserPort<\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"> <\/mark>setting means you can keep more sockets in the<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\"> TIME_WAIT <\/mark>state.<br><br><\/p>\n\n\n\n<p class=\"has-medium-font-size\">8. To ensure client stability, you can restart the client for a period of time.<br><br><\/p>\n\n\n\n<p class=\"has-medium-font-size\">9. Call the local port API, GET request this address, to restart and automatically log in to the <strong><a href=\"https:\/\/www.vmlogin.us\" data-type=\"URL\" data-id=\"https:\/\/www.vmlogin.us\" target=\"_blank\" rel=\"noreferrer noopener\">VMLogin<\/a><\/strong> client.<\/p>\n\n\n\n<p class=\"has-medium-font-size\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">http:\/\/127.0.0.1:35000\/api\/v1\/client\/restart<\/mark> Restart client (no request parameters).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. When running automated tasks on the computer for a l [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-280","post","type-post","status-publish","format-standard","hentry","category-api"],"_links":{"self":[{"href":"https:\/\/www.vmlogin.us\/help\/wp-json\/wp\/v2\/posts\/280","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vmlogin.us\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vmlogin.us\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vmlogin.us\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vmlogin.us\/help\/wp-json\/wp\/v2\/comments?post=280"}],"version-history":[{"count":13,"href":"https:\/\/www.vmlogin.us\/help\/wp-json\/wp\/v2\/posts\/280\/revisions"}],"predecessor-version":[{"id":2490,"href":"https:\/\/www.vmlogin.us\/help\/wp-json\/wp\/v2\/posts\/280\/revisions\/2490"}],"wp:attachment":[{"href":"https:\/\/www.vmlogin.us\/help\/wp-json\/wp\/v2\/media?parent=280"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vmlogin.us\/help\/wp-json\/wp\/v2\/categories?post=280"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vmlogin.us\/help\/wp-json\/wp\/v2\/tags?post=280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}