I used option 1 and so far so good. Thanks.

Regards
Mehrshad

-----Original Message-----
From: Michael Becke [mailto:[EMAIL PROTECTED] 
Sent: Sunday, December 11, 2005 1:22 PM
To: HttpClient Project
Subject: Re: Read blocking on GetMethod's getResponseBody

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%20con
nection%20parameters>

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

Mike

On 12/11/05, Mehrshad Setayesh <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to