You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "Nathan P. Gardner" <Ga...@cat.com> on 2007/06/15 20:58:03 UTC

When exactly does a socket timeout get triggered?

When exactly does a socket timeout get triggered?


Is it when the SO_TIMEOUT time has been reached and the first byte of data 
has not been received?

Or is it when the SO_TIMEOUT time has been reached and the last byte of 
data has not been received?


In other words, if you start receiving data before the SO_TIMEOUT time has 
been reached, but are still receiveing data after the SO_TIMEOUT time has 
been reached, does this cause a timeout or not?


Thanks,
Nate Gardner

Re: When exactly does a socket timeout get triggered?

Posted by Bala mani <ba...@gmail.com>.
Hi Roland,
Could u tell me how to extract the time of arrival of the first byte.

On 6/16/07, Roland Weber <os...@dubioso.net> wrote:
>
> Hello Nathan,
>
> > When exactly does a socket timeout get triggered?
> >
> > Is it when the SO_TIMEOUT time has been reached and the first byte of
> data
> > has not been received?
>
> Yes. Socket timeouts are per read operation. If you receive a
> response, even with only a single byte of data, before the
> timeout hits, then the read operation succeeds. If you want
> to read more data, you have to call another read operation,
> which will start a new timeout interval. This is not specific
> to HTTP, it's general socket behavior:
>
> http://java.sun.com/j2se/1.4.2/docs/api/java/net/Socket.html#setSoTimeout(int)
>
> hope that helps,
>   Roland
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
>
>

Re: When exactly does a socket timeout get triggered?

Posted by "Nathan P. Gardner" <Ga...@cat.com>.
Roland, yes, thanks for the info.


Thanks,
Nate Gardner




Roland Weber <os...@dubioso.net> 
06/16/2007 05:50 AM
Please respond to
"HttpClient User Discussion" <ht...@jakarta.apache.org>



To
HttpClient User Discussion <ht...@jakarta.apache.org>
cc



Subject
Re: When exactly does a socket timeout get triggered?




Caterpillar: Confidential Green Retain Until: 07/16/2007        Retention 
Category:  G90 - General Matters/Administration


Hello Nathan,

> When exactly does a socket timeout get triggered?
> 
> Is it when the SO_TIMEOUT time has been reached and the first byte of 
data 
> has not been received?

Yes. Socket timeouts are per read operation. If you receive a
response, even with only a single byte of data, before the
timeout hits, then the read operation succeeds. If you want
to read more data, you have to call another read operation,
which will start a new timeout interval. This is not specific
to HTTP, it's general socket behavior:
http://java.sun.com/j2se/1.4.2/docs/api/java/net/Socket.html#setSoTimeout(int)


hope that helps,
  Roland


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



Re: When exactly does a socket timeout get triggered?

Posted by Roland Weber <os...@dubioso.net>.
Hello Nathan,

> When exactly does a socket timeout get triggered?
> 
> Is it when the SO_TIMEOUT time has been reached and the first byte of data 
> has not been received?

Yes. Socket timeouts are per read operation. If you receive a
response, even with only a single byte of data, before the
timeout hits, then the read operation succeeds. If you want
to read more data, you have to call another read operation,
which will start a new timeout interval. This is not specific
to HTTP, it's general socket behavior:
http://java.sun.com/j2se/1.4.2/docs/api/java/net/Socket.html#setSoTimeout(int)

hope that helps,
  Roland


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