cURL / Mailing Lists / curl-library / Single Mail


RE: Using libCURL asynchronously

From: Michael Mastroianni <>
Date: Tue, 13 Jul 2004 13:42:38 -0400

One note. If you're doing multi-threaded stuff on windows, you probably
want to build using ares.

I built the default version that comes in the zip file, and kept having
problems with blowups in gethostbyname when I had a lot of threads.

Using ares, I've run using 800 threads downloading with no problems at

-----Original Message-----
[] On Behalf Of Evil Kosh
Sent: Tuesday, July 13, 2004 1:08 PM
To: libcurl development
Subject: Re: Using libCURL asynchronously

Hi Andy,

thanks for the suggestion, but it doesnt really help. Let me explain.
When I am waiting for a download to begin, I want to continue my
programs execution, I dont want curl to stop execution of my
application, whilst it for example, connects or not, to a website, the
timeout idea you came up with, would serve as a failure in my app, since

it would consider NOT being able to connect a problem, but this isnt
what I want, I dont want to manipulate the amount of time before curl
returns either connected or not, I want to connect, then in the
meantime, be able to process menu commands and other operations WHILST
curl is connecting (or not). I think I'm going to go with threads as it

seems that there is no other way to get around this. But I'll have to
do a 1.1 release or something for that, since it's not on my checklist
as it stands.

Thanks mate, cya

Chris Thomas
Md Antimatter Studios

Andy hobbs wrote:

>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
>your own time out, see the examlpe c files in the online docs for a
>really good example.
>Hope this helps
>On Sun, 2004-07-11 at 13:11, Evil Kosh wrote:
>>Hi guys,
>>ok, got a small problem. My application, when the internet is
>>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
>>1/2 second to do something before the next download kicks in, then
>>stall for 30 seconds again, all this time, you are not able to
>>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
Received on 2004-07-13