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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:37:11+00:00 2026-06-10T19:37:11+00:00

I have been testing a small embedded web server, Web server , (it is

  • 0

I have been testing a small embedded web server, Web server, (it is running mike G.’s multisocket server). I am trying to get get a response from the server using the android virtual devices in eclipse and for some reason the server fails to respond half the time.

here is the logcat of the error. “on” is the string the server will respond with when successful.

09-03 23:12:54.672: I/System.out(996): on
09-03 23:12:55.989: I/System.out(996): on
09-03 23:12:57.113: D/dalvikvm(996): GC_FOR_MALLOC freed 882K, 53% free 3142K/6663K,           external 1625K/2137K, paused 37ms
09-03 23:12:57.113: W/System.err(996): org.apache.http.NoHttpResponseException: The target server failed to respond
09-03 23:12:57.122: W/System.err(996):  at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:85)
09-03 23:12:57.122: W/System.err(996):  at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
09-03 23:12:57.122: W/System.err(996):  at   org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:179)
09-03 23:12:57.122: W/System.err(996):  at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:235)
09-03 23:12:57.122: W/System.err(996):  at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
09-03 23:12:57.132: W/System.err(996):  at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:279)
09-03 23:12:57.132: W/System.err(996):  at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
09-03 23:12:57.132: W/System.err(996):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:421)
09-03 23:12:57.132: W/System.err(996):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
09-03 23:12:57.132: W/System.err(996):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
09-03 23:12:57.132: W/System.err(996):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
09-03 23:12:57.132: W/System.err(996):  at com.SS.Main.TestHttpGet.executeHttpGet(TestHttpGet.java:40)
09-03 23:12:57.132: W/System.err(996):  at com.SS.Main.SmartHomeSystemActivity$1.onClick(SmartHomeSystemActivity.java:32)
09-03 23:12:57.132: W/System.err(996):  at android.view.View.performClick(View.java:2485)
09-03 23:12:57.132: W/System.err(996):  at android.view.View$PerformClick.run(View.java:9080)
09-03 23:12:57.142: W/System.err(996):  at android.os.Handler.handleCallback(Handler.java:587)
09-03 23:12:57.142: W/System.err(996):  at android.os.Handler.dispatchMessage(Handler.java:92)
09-03 23:12:57.142: W/System.err(996):  at android.os.Looper.loop(Looper.java:123)
09-03 23:12:57.142: W/System.err(996):  at android.app.ActivityThread.main(ActivityThread.java:3683)
09-03 23:12:57.142: W/System.err(996):  at java.lang.reflect.Method.invokeNative(Native Method)
09-03 23:12:57.142: W/System.err(996):  at java.lang.reflect.Method.invoke(Method.java:507)
09-03 23:12:57.142: W/System.err(996):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
09-03 23:12:57.142: W/System.err(996):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
09-03 23:12:57.152: W/System.err(996):  at dalvik.system.NativeStart.main(Native Method)

I tried to make a retry handler from this thread

retry handler

but that didnt seem to fix it (or i was using it incorrectly) so i decided to try to just keep re-sending the request. Here is the code that is working, but i feel it is not a good way to do it. The server has no problems when a browser from a PC sends the request, but will fail to respond sometimes with android browsers and the application emulation. any ideas?

 package com.SS.Main;

 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.URI;

 import org.apache.http.HttpEntityEnclosingRequest;
 import org.apache.http.HttpRequest;
 import org.apache.http.HttpResponse;
 import org.apache.http.NoHttpResponseException;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.HttpRequestRetryHandler;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.AbstractHttpClient;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.impl.client.DefaultHttpRequestRetryHandler;
 import org.apache.http.params.HttpProtocolParams;
 import org.apache.http.protocol.ExecutionContext;
 import org.apache.http.protocol.HttpContext;

 public class TestHttpGet {

 public void executeHttpGet() throws Exception {

    BufferedReader in = null;

    try {
        HttpClient client = new DefaultHttpClient();
        HttpGet request = new HttpGet();

        HttpProtocolParams.setUseExpectContinue(client.getParams(), false);


        request.setURI(new URI("http://142.197.135.16:5000/aled.htm?led=on"));

        //HttpResponse response = client.execute(request);

        HttpResponse response = null;

        boolean RetryConnection = true;
        int retrycount = 0;

        //retry request 5 times
        while(RetryConnection == true && retrycount < 5)
        {
            try{
                 response = client.execute(request);
                 RetryConnection = false;
            }catch(IOException e)
            {
                System.out.println("caught");
                retrycount += 1;
            }
        }



        in = new BufferedReader
        (new InputStreamReader(response.getEntity().getContent()));

        StringBuffer sb = new StringBuffer("");
        String line = "";
        String NL = System.getProperty("line.separator");

        while ((line = in.readLine()) != null) {
            sb.append(line + NL);
        }
        in.close();

        String page = sb.toString();

        System.out.println(page);
        } finally {
        if (in != null) {
            try {
                in.close();
                } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
}
  • 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-10T19:37:13+00:00Added an answer on June 10, 2026 at 7:37 pm

    turns out it was the server that was the problem. The way the server was setup it was not getting enough time to process the incoming request. The solution to the problem can be found in this link.

    Spinneret web server fix

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

Sidebar

Related Questions

I have been trying to get the hang of TDD and unit testing (in
I have been testing the performance of reading server socket input stream. I found
I have been doing TDD and was using it more as unit testing than
I have been looking at EasyMock and tutorials/examples around using it for Unit Testing
I have been writing a small web application in C# .NET4.0 to try and
I have just been testing a web site I have set up in Internet
I am currently testing a small application I have written. I have not been
I have been using C# for some time now to make a small game,
In trying to write more testable Java code, I have been using the Model-View-Presenter
I have been testing and playing around with jquery date picker below. http://jqueryui.com/demos/datepicker/ on

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.