curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Forcing curl_multi_perform() to return regularly

From: Andreas Falkenhahn via curl-library <>
Date: Fri, 15 Jan 2021 14:03:10 +0100

I'm trying to find a way to transfer a file with curl regularly returning control to my program so that it can do other things. I can't use curl_easy_perform() because it will not return before the transfer has completed.

So I gave curl_multi_perform() a try because this is said to return "as soon as the reads/writes are done". Under normal circumstances, this works quite nicely and it will regularly return control to me.

However, I've now tried to simulate certain stress situations to see how it behaves in those cases. For example, by inserting a throttle in CURLOPT_WRITEFUNCTION. By making the write function so slow that there's always new data after the write function returns, curl_multi_perform() now behaves as I feared: it will _never_ return to control to me because, obviously, there is always work to do because of the throttle I inserted in my write function.

That's why I'd like to ask: Is there any way to force curl_multi_perform() to return even if there's still work to do?

Best regards,
 Andreas Falkenhahn                
Received on 2021-01-15