android httpclient hangs on second request to the server (connection timed out)

Sounds like you don’t consume the entity after you finish handling the response. Ensure you put the following code in the finally block:

if (httpEntity != null) {
    try {
        httpEntity.consumeContent();
    } catch (IOException e) {
        Log.e(TAG, "", e);
    }
}

I suggest you read the HttpClient Tutorial.

Leave a Comment