cURL / Mailing Lists / curl-library / Single Mail


Re: multi_perform in sequence fails

From: Nilesh <>
Date: Mon, 29 May 2006 19:43:00 +0530

Daniel Stenberg wrote:

> On Mon, 29 May 2006, Nilesh wrote:
>> do_perform(multi_handle)
>> {
>> /*This function does typical curl_multi_peroform operation and
>> check for return status */
>> }
> Are you saying this repeatedly calls curl_multi_perform() until the
> whole process is complete or are you just calling curl_multi_perform()
> once in this function?

Calling it once. I am using almosy similar code given in example
directory and multi-single.c file

> curl_multi_perform() is non-blocking, a single call just performs a
> very small fraction of a full operation.


>> init_curl(CURLM **multi_handle, CURLM **out_handle)
> This function does not actually want two CURLM handles...

Sorry for typing mistake here. I meant, init_curl(CURLM **multi_handle,
CURL **out_handle)....

>> if(CURLE_OK != (curlrc = curl_multi_add_handle(*multi_handle,
>> *out_handle))) return curlrc;
> ... since curl_multi_add_handle() adds a CURL handle to a CURLM handle.
>> init_curl(&multi_handle, &out_handle);
>> /*Set outgoing buffer */
>> strcpy(out_buffer, "initial data");
>> curl_easy_setopt(out_handle, CURLOPT_POSTFIELDS, out_buf);
> curl_easy_setopt() operates on a CURL handle.
>> strcpy(out_buffer, "subsequent data");
>> curl_easy_setopt(out_handle, CURLOPT_POSTFIELDS, out_buf);
>> do_perform(&multi_handle); ///--------- Here, data is not send to
>> server
> After a transfer is completed, you need to add new easy handles to the
> multi handles to initiate new transfers. So if you change the URL of
> the same easy handle you already used, you still need to add it to the
> multi handle again to make a second transfer.

Ok. Anyway my URL is the same. Only thing I want to change is data which
will be posted to same URL again and again.
So as I understand before I do perform with new data and same
multi_handle -
- cleanup already used easy_handle
- create new easy_handle and add it to multi_handle stack
- and then perform. that case I will have to again set all options to easy
handle which are set in init_cutl function and add it to multi_handle stack.
Is that the case ? why can't same handle be used ?

Received on 2006-05-29