cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Asynchronous transfers - details requested

From: Armel Asselin <asselin.armel_at_wanadoo.fr>
Date: Fri, 6 Oct 2006 10:37:18 +0200

Hi Vincent,

> Hello,
>
> I'm a new user to the curl library. I read the archives and saw that the
> only way to have an asynchronous HTTP transfer with curl is to use the
> multi interface.
>
> I'm writing a wrapper that I'de like to be able to use as shown in the
> following pseudo-code:
>
>
> int reqId = wrapper.PerformRequest (an http request);
>
> while (!wrapper.haveResults(reqId))
> process messages
>
> Answer a = wrapper.GetAnswer(reqId);
>
> ....
>
>
> It's very important that I am able to process messages because it implies
> a screen refresh, and my requests might be long. I'm not able to process
> messages in the write_data function.
>
> If I use the multi interface with only one easy handle, will I be able to
> have a this kind of behavior ? Will the curl_multi_perform() function
> "cut" the transfer in small pieces ? A previous message told the function
> is not blocking, but I don't see well how it behaves. Would someone have a
> rough pseudo-code to provide ?
had a look to multi.c sample?
just put your message handling stuff in the middle of the multi loop [or the
opposite, call multi perform from within your message handling loop if it is
more practical for you].

HIH
Armel
Received on 2006-10-06