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 6892439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:32:08+00:00 2026-05-27T06:32:08+00:00

I am creating a test app to load test a comet servlet by creating

  • 0

I am creating a test app to load test a comet servlet by creating a bunch of outbound https connections (each looping in its own thread).

Is there a limit on the number of concurrent outbound http requests? If so, is it an OS level issue (xp 32bit) or Java? I get the following exception when running around 100 connections. The error does not occur instantly but after anywhere between 50-150 loops (sometimes more), leading me to suspect that it actually might be me not releasing resources correctly:

java.net.BindException: Address already in use: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
    at java.net.Socket.connect(Socket.java:529)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:559)
    at         com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:141)
 at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
 at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
 at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
 at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:272)
 at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:329)
 at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
 at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:916)
 at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1177)
 at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
 at fqexconnectiontesting.FQEXHttpClient.run(FQEXHttpClient.java:158)
 at java.lang.Thread.run(Thread.java:662)

My code:

while(true){
try{                    
connection =(HttpsURLConnection) url.openConnection();                    
connection.setDoOutput(true);
connection.setRequestProperty("keep-alive", "true");
connection.setRequestMethod("GET");
input = new DataInputStream( connection.getInputStream() ); 
b = new byte[4096];                    
totalBytes += input.read(b);                    
input.close();
b = null;         
connection.disconnect();                                        
connection = null;
Thread.sleep(100);
}

Any ideas appreciated.

Thanks,
Dazz

  • 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-27T06:32:09+00:00Added an answer on May 27, 2026 at 6:32 am

    By default Java opens only up to 5 persistent connections to the same host.
    But your code uses the disconnect() method which AFAIK prevents persistent connections.

    You should better read the documentation about Persistent Connections. Take the sample code near the end for getting a fully working persistent connection.

    May be this fixes your problem.

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

Sidebar

Related Questions

I'm creating test data for a Rails app. How do I define the value
I am creating a test app that will work with query string values. I
I'm currently working on creating an environment to test performance of an app; I'm
I have the following couple of C pre-processor macros for creating test functions: //
When I am creating a test project in Visual Studio, do I just create
I am creating a test program to test the functionality of program which calcultes
#1 Lua: local test = Test(); #2 C: //creating lua's test luaL_newmetatable(L, someTable); lua_userdata
I am creating a file-oriented database of some test results performed by various users.
I am creating webtests in TFS and trying to test reports execution in SSRS.
I am creating an SHTML website and I am wondering how can you test

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.