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

前端 未结 7 2134
后悔当初
后悔当初 2020-11-29 06:16

I\'m struggling with the following problem: My App makes sequence of requests to the http server using HttpClient. I use HttpPut for sending data to the server. First reques

7条回答
  •  悲哀的现实
    2020-11-29 06:29

    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.

提交回复
热议问题