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.
Reseting a curl multi handle for reuse
- Contemporary messages sorted: [ by date ] [ by thread ] [ by subject ] [ by author ] [ by messages with attachments ]
From: Taw via curl-library <curl-library_at_lists.haxx.se>
Date: Mon, 21 Aug 2023 10:34:12 +0000 (UTC)
Hello,
I am already reusing a curl easy handle, but not sure how to reuse a curl multi handle.
My current (psuedo)code is like this.
curlEasy = curl_easy_init();
// connection 1// set options 1curl_easy_perform(curlEasy);curl_easy_reset(curlEasy);
// connection 2// set options 2curl_easy_perform(curlEasy);curl_easy_reset(curlEasy);
// and so on
curl_easy_cleanup(curlEasy);
I want to use a multi handle for async connection.Not sure if the code belowis correct, because I don't see any curl_multi_reset in the documentation and I don't know how to reset it.What happens to the curlMulti if I don't reset it between calls, especially in case of errors?
curlMulti = curl_multi_init();curlEasy = curl_easy_init();
// connection 1// set options 1curl_multi_add_handle(curlMulti, curlEasy);
curl_multi_perform(curlMulti);curl_multi_remove_handle(curlMulti, curlEasy);
curl_easy_reset(curlEasy);
// connection 2// set options 2 curl_multi_add_handle(curlMulti, curlEasy);
curl_multi_perform(curlMulti);curl_multi_remove_handle(curlMulti, curlEasy);
curl_easy_reset(curlEasy);
curl_easy_cleanup(curlEasy);
curl_multi_cleanup(curlMulti)
thank you
Date: Mon, 21 Aug 2023 10:34:12 +0000 (UTC)
Hello,
I am already reusing a curl easy handle, but not sure how to reuse a curl multi handle.
My current (psuedo)code is like this.
curlEasy = curl_easy_init();
// connection 1// set options 1curl_easy_perform(curlEasy);curl_easy_reset(curlEasy);
// connection 2// set options 2curl_easy_perform(curlEasy);curl_easy_reset(curlEasy);
// and so on
curl_easy_cleanup(curlEasy);
I want to use a multi handle for async connection.Not sure if the code belowis correct, because I don't see any curl_multi_reset in the documentation and I don't know how to reset it.What happens to the curlMulti if I don't reset it between calls, especially in case of errors?
curlMulti = curl_multi_init();curlEasy = curl_easy_init();
// connection 1// set options 1curl_multi_add_handle(curlMulti, curlEasy);
curl_multi_perform(curlMulti);curl_multi_remove_handle(curlMulti, curlEasy);
curl_easy_reset(curlEasy);
// connection 2// set options 2 curl_multi_add_handle(curlMulti, curlEasy);
curl_multi_perform(curlMulti);curl_multi_remove_handle(curlMulti, curlEasy);
curl_easy_reset(curlEasy);
curl_easy_cleanup(curlEasy);
curl_multi_cleanup(curlMulti)
thank you
-- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.htmlReceived on 2023-08-21