cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Setting individual timeouts while using curl multi API.

From: Nick Gerner <nick_at_seomoz.org>
Date: Tue, 21 Jul 2009 17:08:13 +0000

> Can someone please advise how to setup timeouts for the individual easy
> handles while using the curl multi interface? Do the CURLOPT_TIMEOUT_MS
> and CURLOPT_CONNECTTIMEOUT options not work with the multi interface? If
> yes, how does the application know that these timeouts have been
> triggered?
>

We're doing application level timeouts. So we monitor our handles and
remove them from the multi handle when we think things are timed out.
This gives us a lot of flexibility and control.

I think that if there's no activity on any of the handles and you've
set CURLOPT_NOSIGNAL, then curl won't ever get interrupted and so
can't apply timeouts. You could make sure that your app doesn't block
for more than a few seconds which should give you enough granularity.

Daniel, et al.: what's the impact of calling into the curl multi with
a timeout even if the specified timeout hasn't expired?

All of that said, I've seen the timeouts inside curl work (giving a
curl error of 28), even with CURLOPT_NOSIGNAL in most of my scenarios.
 Can you provide code?

--Nick
Received on 2009-07-21