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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:11:41+00:00 2026-06-16T22:11:41+00:00

I am using HTTP post connection and my app periodically makes connections to the

  • 0

I am using HTTP post connection and my app periodically makes connections to the server. After a certain point I can’t connect to the server and I get these exceptions for all of my connections:

java.net.ConnectException;failed to connect to http://www.somedomain.com/xxx.xxx.xxx.x (port 80): connect failed: ENETUNREACH (Network is unreachable)

org.apache.http.conn.HttpHostConnectException;Connection to http://www.somedomain.com refused

java.net.UnknownHostException;Unable to resolve host “www.somedomain.com”: No address associated with hostname

I suspect that the server might be blocking me after a certain point. Any ideas why this might be happening? After I reinstall the app the connection is still blocked.

EDIT: here is the code for sending http requests

public String send() throws ClientProtocolException, IOException {
    InputStream is = null;
    DefaultHttpClient httpclient = null;
    HttpResponse response = null;
    try {
        System.setProperty("http.keepAlive", "false");
        httpclient = new DefaultHttpClient();
        HttpProtocolParams.setUseExpectContinue(httpclient.getParams(), false);
        HttpRequestRetryHandler retryHandler = new HttpRequestRetryHandler() {

            public boolean retryRequest(IOException exception, int executionCount,
                    HttpContext context) {
                // retry a max of 5 times
                if(executionCount >= 5){
                    return false;
                }
                if(exception instanceof NoHttpResponseException){
                    return true;
                } else if (exception instanceof ClientProtocolException){
                    return true;
                } 
                return false;
            }
        };
        httpclient.setHttpRequestRetryHandler(retryHandler);
        String proxyHost = android.net.Proxy.getDefaultHost();
        int proxyPort = android.net.Proxy.getDefaultPort();
        // Set Proxy params of client, if they are not the standard
        if (proxyHost != null && proxyPort > 0) {
            HttpHost proxy = new HttpHost(proxyHost, proxyPort);
            httpclient.getParams().setParameter(
                    ConnRoutePNames.DEFAULT_PROXY, proxy);
        }
        HttpPost httppost = new HttpPost(url);
        httppost.setEntity(new UrlEncodedFormEntity(qData));
        response = httpclient.execute(httppost);
        is = response.getEntity().getContent();
        return inputStreamToString(is);
    } finally {
        try {
            if (is != null) {
                is.close();
            }
        } catch (Throwable e) {
        }
        try {
            if (response != null && response.getEntity() != null) {
                response.getEntity().consumeContent();
            }
        } catch (Throwable e) {
        }
        try {
            if (httpclient != null
                    && httpclient.getConnectionManager() != null) {
                httpclient.getConnectionManager().shutdown();
            }
        } catch (Throwable e) {
        }
    }
}
  • 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-16T22:11:42+00:00Added an answer on June 16, 2026 at 10:11 pm

    You can use dig or nslookup to verify the DNS server. You can configure a known good DNS server in your OS like 8.8.8.8 .
    The exception error message might also be misleading: try capturing the network traffic with wireshark, then you’ll see whether the DNS query returns nothing at all, “not found”, or is the DNS fine, but the server host rejecting your request.

    You can also bypass DNS uncertainty by adding http://www.somedomain.com to your hosts file with its IP address.

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

Sidebar

Related Questions

I'm stuck trying to get a WinInet HTTP POST via SSL using ONLY C.
I am writing an application in which I am using Http Connection to post
when using http post with flash that send ip address request from client computer
im trying to do a file upload using http post but when I try
The application I'm building right now has problems when using HTTP post. When timeout
I'm using jQuery to make an Ajax call using an Http Post in ASP.NET
I'm trying to follow this tutorial using StructureMap : http://iridescence.no/post/Constructor-Injection-for-ASPNET-MVC-Action-Filters.aspx What I'm trying to
I am using the WebClient class in .NET 2.0 to perform an HTTP POST
Currently, I am using Camel as an orchestration engine (it receives a HTTP POST
I'm trying to POST a http request using ajax, but getting a response from

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.