cURL / Mailing Lists / curl-library / Single Mail


reuse easy curl handle with multi interface

From: Alex Stanciu <>
Date: Fri, 15 Jul 2011 10:03:50 +0300


I am working on a backup application (FTP/SFTP/FTPS), things
worked fine so far (upload/download/commands and so on)
but now I need to get a bit of control over curl_easy_perform

I tried with curl_multi_perform so my reads/writes can be mapped
to a generic function like fread. I used the example in your
docs, I get no errors and all calls return CURLM_OK

Now before I send the code :), can you just tell me if this usage is

1. Use a CURL easy handle to common operations (FTP/SFTP)
(this works fine)
2. Reuse the handle in all operations (also works ok)
3. Reuse the handle over multiple threads using my own
locks (2 operations can not take place at the same time)
(also works fine)
4. Temporary create a multi handle
add the easy handle (reuse) to the multi handle
and perform a FTP get (or upload)
this FAILS, my CURLOPT_WRITEFUNCTION is never called (for get)

for point 4:
curl_easy_setopt(URL + rest)
(CURLOPT_UPLOAD is also set to 0 for load)
curl_multi_add_handle(multi_handle, handle->curl_handle)
(returns CURLM_OK)
(returns CURLM_OK)
then i do the while (still_running) ... just like in the sample code

as I said everything looks ok when debugging except CURLOPT_WRITEFUNCTION
is not called and (ofc) no data is written to the buffer

OS: Windows Vista
Win32 2000/XP
7.21.7 libcurl
SSL enabled
GŁnter Knauf 3.06 MB

Many Thanks.

Best regards,

List admin:
Received on 2011-07-15