curl-library
Re: socket timeouts
Date: Wed, 30 Jun 2010 18:20:45 -0400
On Tue, Jun 29, 2010 at 06:30:11PM -0700, Toby Peterson wrote:
> On Jun 29, 2010, at 6:10 PM, Ben Kibbey wrote:
>
> > There are timeout options for DNS lookups, connecting and total
> > download data but what about socket timeouts? Can this can be done via
> > setsockopt(2) and SO_RCVTIMEO and as an curl_easy_setopt() option?
>
> Set a callback with CURLOPT_SOCKOPTFUNCTION, use the callback to call
> setsockopt() etc.
The problem is that the socket is set to non-blocking via
curlx_nonblock() so it doesn't seem possible to determine whether the
transfer timed out or there was no data available. The read() would
return -1 with errno set to EAGAIN in either case.
Maybe add a curl_easy option to specifiy a socket timeout then update
some elapsed time at every iteration of the read() loop and reset when
new data becomes available?
-- Ben Kibbey Jabber: bjk AT thiessen DOT org - (bjk) FreeNode/OFTC ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2010-07-01