2

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?

3
  • 2
    Why are you opening these many connections in the first place? Are you not closing the connections after using them? Commented Aug 27, 2013 at 11:15
  • It actually looks like you are trying to listen on a huge number of sockets, unless you are calling bind() yourself for some reason on your client sockets, in which case the simple answer is "don't". Commented Aug 28, 2013 at 1:21
  • I followed this solution(stackoverflow.com/questions/10088363/…) that recommended downloading a patch to fix this error. It didn't work, but updating the MaxUserPort registry key like you suggested did. Thank You. Commented Sep 2, 2014 at 21:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.