cURL / Mailing Lists / curl-library / Single Mail


Re: multi_perform in sequence fails

From: Daniel Stenberg <>
Date: Mon, 29 May 2006 15:17:44 +0200 (CEST)

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

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...

> 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.

  Commercial curl and libcurl Technical Support:
Received on 2006-05-29