hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Becke <mbe...@gmail.com>
Subject Re: Read blocking on GetMethod's getResponseBody
Date Sun, 11 Dec 2005 20:21:54 GMT
Hi Mehrshad,

You have two options:

 1) Set the socket timeout value.  This configures how long the socket
will block for any one read operation.  It does not however limit the
total time taken when executing a method.

http.socket.timeout -
<http://jakarta.apache.org/commons/httpclient/preference-api.html#HTTP%20connection%20parameters>

2) Call HttpMethod.abort() from a second thread after the desired wait
time has been reched.

Mike

On 12/11/05, Mehrshad Setayesh <mehrshad@collectiveintellect.com> wrote:
> Hello:
>
> I am using commons-httpclient-3.0-rc3.
>
> Every once in a while my getResponseBody call on a GetMethod blocks
> indefinitely. I have tried using getResponseBodyAsStream but the call now
> blocks on read method.
>
> How can I specify a timeout value, so if no bytes are received within a
> timeframe, timeout occurs and method exits.
>
> Regards
> Mehrshad
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org


Mime
View raw message