cURL / Mailing Lists / curl-library / Single Mail


Re: curl_multi_perform usage & easy handle "reset"

From: Davide Pippa <>
Date: Fri, 10 Aug 2007 18:03:21 +0200

On 8/10/07, Davide Pippa <> wrote:
> Hi!
> I'm using libcurl to do some http transfer, and I'm having some
> trouble with the usage of the curl_multi_perform. I attach a test
> program to show what's happening.
> I try to download a web page doing a GET request
> I'm using libcurl to do http transfers, I'm trying to do a GET on a
> web page to download it; I'm using the multi interface with select().
> My problem is that the transfer sometimes works sometime not, I guess
> there is some problem in my code anyway... it happens that:
> - if I first initialize my easy handle with the URL (and other needed
> options) and then call the curl_multi_perform(), then the transfer
> works;
> - if I first do a curl_multi_perform() on an uninitialized easy handle
> (as it is returned by curl_easy_init()) it says "no URL"; that's ok;
> then I initialize the easy handle and call again the
> curl_multi_perform(); here the transfer does not work. Is there any
> missing initialization/reset to do between two transfers?


I somewhat solved the thing that way:
- by never passing to curl_multi_add_handle() an easy handle that has
not been initialized (with URL and other options);
- by doing the remove_handle() after each transfer and re-doing the
add_handle() to begin a new transfer (reusing the same easy handle);

Then I suppose reusing an easy handle with multi interfare involves
removing it after transfer has finished and adding it again to begin a
new transfer?


Received on 2007-08-10