0

i have a strange problem with AndroidHttpClient. Sometimes i got the error connection refused on the same internal webservice. In the access log on my server I have no log entry for the request, so it seems that the server is not called. Connection with wifi is ok.

I tried to connect to different servers, the problem occurs on other servers too. Has anyone an explanation for this?

Code:

HttpParams httpParams = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParams, 120000);
HttpConnectionParams.setSoTimeout(httpParams, 120000);

AndroidHttpClient httpclient = AndroidHttpClient.newInstance("Android");

HttpPost httppost = new HttpPost(url);
httppost.setParams(httpParams);

ResponseHandler<String> responseHandler = new BasicResponseHandler();
String responseBody = httpclient.execute(httppost, responseHandler);

Best regards, Peter

Peter
  • 1,011
  • 2
  • 16
  • 39
  • you are using the emulator? – Anderson K Mar 09 '15 at 11:52
  • No, I am not using the emulator. – Peter Mar 09 '15 at 12:14
  • possible duplicate of [Android HTTP Connection refused](http://stackoverflow.com/questions/9469060/android-http-connection-refused) – ArchiFloyd Mar 09 '15 at 12:28
  • Has anybode ever faced this problem? The problem still exists. When I call the service from my server from a laptop in the same wlan, no problems occur. Only when I access the service in my app, there are so many errors like Connection failed: EHOSTUNREACH (No route to host) – Peter Apr 04 '16 at 12:30

0 Answers0