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

  • Home
  • SEARCH
  • 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 7900057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:52:11+00:00 2026-06-03T08:52:11+00:00

I need to make about 15 calls to diferent web services (php) at the

  • 0

I need to make about 15 calls to diferent web services (php) at the application startup.

I’m using the following code for the post

public static String post(String url, List<BasicNameValuePair> 
           postvalues, HttpClient httpclient) {
    try {
        if (httpclient == null) {
            httpclient = new DefaultHttpClient();
        }
        HttpPost httppost = new HttpPost(url);

        if ((postvalues == null)) {
            postvalues = new ArrayList<BasicNameValuePair>();
        }
        httppost.setEntity(new UrlEncodedFormEntity(postvalues, "UTF-8"));

        // Execute HTTP Post Request
        HttpResponse response = httpclient.execute(httppost);
        return requestToString(response);
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }

}



private static String requestToString(HttpResponse response) {
    String result = "";
    try {
        InputStream in = response.getEntity().getContent();
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        StringBuilder str = new StringBuilder();
        String line = null;
        while ((line = reader.readLine()) != null) {
            str.append(line + "\n");
        }
        in.close();
        result = str.toString();
    } catch (Exception ex) {
        result = "Error";
    }
    return result;
}

The problem is that some of the petitions must be requested in a given order and each request takes about 1-2 second so the “Loading splash” takes about 10 seconds.

So my question is:Since all the connections are to the same server, how can I improve this delay? Is there some way of open a connection and send all the petitions through that “tunnel” reducing the delay?

NOTE: I tested the code and the requests take the same time reusing the httpclient using a new one in each connection

Thanks

  • 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-06-03T08:52:13+00:00Added an answer on June 3, 2026 at 8:52 am

    What you have in mind is a HTTP persistent connection which reuses the TCP connection.

    About this topic there is already a good question & answer here on Stackoverflow:

    Persistent HttpURLConnections on Android

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

Sidebar

Related Questions

I'm about to create an ASP.net MVC3 application where I need to make a
I need to make some POST calls to my server, but I need to
I have a question about scheduling. I need to make a timetable generator for
I need information about making installation packages for Linux. I want to make simple
I need to make a lot of operations using BigDecimal, and I found having
I need to make an application in .NET CF with different/single forms with a
We currently have developed an application using WCF. Our clients make connections to different
I'm writing a .Net C# application that will make SOAP calls to a configured
I have a crystal report file I need make a tiny edit in. It
I need to make a poker game for school in c++. I have made

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.