I am looking a solution of the exception java.net.SocketException: No buffer space available (maximum connections reached?)
that I am getting in my Logs.
Environment: Windows Server 2008 R2 JDK 7 update 25
Stack Trace:
java.net.SocketException: No buffer space available (maximum connections reached?): JVM_Bind at java.net.TwoStacksPlainSocketImpl.socketBind(Native Method) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.TwoStacksPlainSocketImpl.bind(TwoStacksPlainSocketImpl.java:101)
The solution that I am getting in all the hits-
The solution is to open the registry editor and locate the registry subkey:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters and add a new entry as shown below:
Value Name: MaxUserPort
Value Type: DWORD
Value data: 65534
Increasing the number of ephemeral TCP ports in registry, is the right solution? What is the other solution? Is there any other programmatic approach to manage and close the these socket connections?