Can't connect to server on 'localhost' of 10048 problem solving method

  • 2020-06-01 11:09:49
  • OfStack

Address Can't connect to server on localhost' (10048), 1 as seen in windows 2003 servers using mysql.

Reasons for the error:

The application needs to quickly release and create new connections, but because the connections that exist in TIME_WAIT exceed the default, the throughput is low.

Solutions:
Closely related to this error are two registry keys for windows: the values for TcpTimedWaitDelay and MaxUserPort.

TcpTimedWaitDelay determine TCP/IP can release has close connection and reuse the resources, must go through the time. To shut down and release the time interval between the appellative TIME_WAIT status, or double MSL (2) the most long life cycle state. During this time, to open the connection to the client and the server costs less than set up a new connection. To reduce this value allows TCP/IP faster to release the closed connection, provide more resources for new connection.

MaxUserPort determine request any available user port from the system used the biggest port number, the most high-end TCP/IP can be specified. If TCP connection to the largest port connection is more than 5000, the local computer response to the following error message WSAENOBUFS (10055) : because the system lacks enough buffer or because a queue was full and unable to perform on the socket operations, leading to the application of 10048 error.

Open the registry editor regedit

TcpTimedWaitDelay Settings:
Find the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Services\TCPIP\Parameters registry subkey
And create a new REG_DWORD value called TcpTimedWaitDelay
Set this value to base 10 30 and base 106 to 0x0000001e
The wait time for this value will be 30 seconds.
The default value for this item is: 0xF0(hexadecimal), and the wait time is set to 240 seconds

MaxUserPort Settings (increase the maximum port connection):
Find the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Services\TCPIP\Parameters registry subkey
And create a new REG_DWORD value called MaxUserPort
Set this value to base 10 minimum 32768
The wait time for this value will be 30 seconds.
Restart the windows system.
Default value for this item: 5000(base 10)

Close the registry editor and restart the windows system.

Related articles: