I have a python REST API server running on my laptop. I am trying to write a leisure client in Android (using Eclipse ADT, etc.) to contact him using the Apache client libraries (org.apache.http.client).
The code is really simple and basically does the following:
HttpGet httpget = new HttpGet(new URI("http://10.0.2.2:8000/user?username=tim"));
HttpResponse response = httpclient.execute(httpget);
However, when executing exceptions, throws a timeout exception. I can’t hit the URL even from the browser in the emulator.
Exception Details
org.apache.http.conn.ConnectTimeoutException: Connect to /10.0.2.2:8000 timed out
However, I tried using the cREST client in Chrome on my laptop, and I can request a REST server.
source
share