cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Facing few problems with Curl Multi timeouts...

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 26 Dec 2008 22:29:31 +0100 (CET)

On Sat, 27 Dec 2008, ameya agnihotri wrote:

> > "What? What part "blocks" in the described operation? You loop until it is
> > done, so of course the entire loop won't complete until it is done but
> > each single curl_multi_perform() surely doesn't block for any lengthy
> > period?"
>
> Apologies for incorrect use of words. What I meant was that the loop
> terminates only after response is received irrespective of the timeout. Is
> this the expected behavior?

That would then reflect the problems with the timeout that I mentioned and
I'll repeat: there's no need for you to rely on libcurl's timeout for this,
you can just remove the handle yourself from the multi handle when you're done
waiting.

People have mentioned problems with this but the work-around is possibly even
the recommended way to do "total time timeouts" when using the multi
interface!

> My application requires to be responsive.

If you do, then you REALLY should not assume that you can do the entire
transfer within a certain time. You use the multi interface to allow your
application to keep doing whatever it needs to do, and then let libcurl do its
stuff when there's things happening over the network. Then your app can be
very responsive even if the transfer takes a long time.

> I am setting timeout in order to ensure that (I am willing to sacrifice
> unavailability of data for the sake of responsiveness).

I'm not the one to tell you how to write your app, but it sounds really weird
to me.

> Moreover, my application is multi-threaded (one multi handle per thread) on
> RHEL4. Are there any platform limitations?

Not any other than the documented ones, no.

-- 
  / daniel.haxx.se
Received on 2008-12-26