Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6017645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:09:32+00:00 2026-05-23T03:09:32+00:00

My java code use several threads, each thread run a ServerSocket and goes in

  • 0

My java code use several threads, each thread run a ServerSocket and goes in accept.
These threads communicate each other using java socket. With 121 threads all work at well, but if I run same code with 256 thread I have this error:

java.net.SocketException: No buffer space available (maximum connections reached?): listen failed
    at java.net.PlainSocketImpl.socketListen(Native Method)
    at java.net.PlainSocketImpl.listen(Unknown Source)
    at java.net.ServerSocket.bind(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)

I use windows xp sp3, there are several post like this (here ), but nobody post a soution for this problem . I have also installed a windows patch for remove the limit on TCP connection but I not solved my problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T03:09:32+00:00Added an answer on May 23, 2026 at 3:09 am

    The message says you may be running out of connections. Have you checked that? You can check the open sockets from the command line using:

    netstat -n
    

    Ensure that you are closing all sockets on both sides (in finally blocks). Remember that listening sockets remain open after you receive a connection. Don’t open and close sockets too quickly (I’d say they can’t be reused immediately which could be related to your issue).

    For a better socket-related performance you can use the java.nio API, but it’s far more complicated than java.net.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several questions about best use of exceptions in Java. Consider the code
I use Eclipse to write Java code and use DropBox to sync my code
I am starting to use some Java code which was written by someone else.
I don't want to use any Java code, I just want to use <jsp:include>
What code analysis tools do you use on your Java projects? I am interested
To use a contrived example in Java, here's the code: enum Commands{ Save(S); File(F);
What tools do you use to find unused/dead code in large java projects? Our
I have several servers running the same code but each handling specific messages (they
I am using Eclipse 3.5 for several different Java/JSP projects. All of our project
In my current project I use IKVM to cross-compile several Java libraries that deal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.