123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #include <stdio.h>
- #include <string.h>
- #include <curl/curl.h>
- int main(void)
- {
- CURL *http_handle;
- CURL *http_handle2;
- CURLM *multi_handle;
- int still_running = 1;
- http_handle = curl_easy_init();
- http_handle2 = curl_easy_init();
-
- curl_easy_setopt(http_handle, CURLOPT_URL, "https://www.example.com/");
-
- curl_easy_setopt(http_handle2, CURLOPT_URL, "http://localhost/");
-
- multi_handle = curl_multi_init();
-
- curl_multi_add_handle(multi_handle, http_handle);
- curl_multi_add_handle(multi_handle, http_handle2);
- while(still_running) {
- CURLMsg *msg;
- int queued;
- CURLMcode mc = curl_multi_perform(multi_handle, &still_running);
- if(still_running)
-
- mc = curl_multi_poll(multi_handle, NULL, 0, 1000, NULL);
- if(mc)
- break;
- do {
- msg = curl_multi_info_read(multi_handle, &queued);
- if(msg) {
- if(msg->msg == CURLMSG_DONE) {
-
- fprintf(stderr, "Transfer completed\n");
- }
- }
- } while(msg);
- }
- curl_multi_remove_handle(multi_handle, http_handle);
- curl_multi_remove_handle(multi_handle, http_handle2);
- curl_multi_cleanup(multi_handle);
- curl_easy_cleanup(http_handle);
- curl_easy_cleanup(http_handle2);
- return 0;
- }
|