cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Using libCURL asynchronously

From: Andy hobbs <andy_at_trogs.org.uk>
Date: Mon, 12 Jul 2004 09:16:51 +0100

Hi,

Check out the multi interface, if you use

curl_multi_fdset(multiHandle, &fdread, &fdwrite, &fdexcep, &maxfd);

and then select() on the sockets your self you should be able to specify
your own time out, see the examlpe c files in the online docs for a
really good example.

Hope this helps

Andy

On Sun, 2004-07-11 at 13:11, Evil Kosh wrote:
> Hi guys,
>
> ok, got a small problem. My application, when the internet is offline,
> stalls whilst curl is waiting for a connection, but this is really
> problematic, since it you have >1 files and the wait is around 30
> seconds to timeout, your app stalls for 30 seconds, then you get around
> 1/2 second to do something before the next download kicks in, then it'll
> stall for 30 seconds again, all this time, you are not able to interact
> with the application because it's effectively in a while() loop
> situation, where the interface isnt able to respond.
>
> So, I'm wondering if there is a way to use libCURL asynchronously,
> without using threads? or is this the ONLY way to do it? if thats so,
> it's not a major problem, it's just not a 5 minute job, plus possible
> race conditions I'd rather avoid.
>
> Thanks for your help guys!
>
> Chris Thomas
> Md, Antimatter Studios

-- 
Andy hobbs <andy_at_trogs.org.uk>
Received on 2004-07-12