cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Asynchronous transfers - details requested

From: Jan Benes <jbenes_at_gmail.com>
Date: Fri, 6 Oct 2006 11:42:21 +0200

first of all, you sure can put your easy requests in separate threads
and thereby make it async yourself (i guess some constrains apply
though, see docs). The multi, afaik, is a function that does a small
portion of work every time you call it and therefore, it's does not
block.
On 10/6/06, Armel Asselin <asselin.armel_at_wanadoo.fr> wrote:
> 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