cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How do timeouts work?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 9 May 2003 09:54:13 +0200 (CEST)

On Thu, 8 May 2003, Dennis Carney wrote:

> If I use CURLOPT_TIMEOUT=120sec (for example), does the connection time out
> if the *entire* transfer takes more than 120 seconds, or does it time out
> if at some point cURL doesn't hear anything from the other end for 120
> seconds (essentially, if there is 120 seconds of silence)?

CURLOPT_TIMEOUT is for the whole operation. If it still transfers after 120
seconds, it'll bail out.

You can make a check for 120 seconds of silence too, if you want that, by
using the CURLOPT_LOW_SPEED_LIMIT and CURLOPT_LOW_SPEED_TIME options.

You can also make a timeout abort yourself by setting a progress function
callback pointer that returns non-zero when you think the time is up.

> Is the answer to this question affected in any way by CURLOPT_NOSIGNAL?

Yes CURLOPT_NOSIGNAL will disable libcurl's ability to stop the DNS lookup,
so if the timeout happens while resolving a name, it will continue until the
name lookup is done before it returns. It would need to use a signal to abort
that.

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com
Received on 2003-05-09