informationdownloaded = curl_easy_perform(curl);
You can also specify a timeout for loading
curl_easy_setopt(hCurl, CURLOPT_TIMEOUT, iTimeoutSeconds);
This is a blocked call until the entire file is downloaded. If you are interested in interrupting a blocked call (for a kill signal), set the progress callback, for example below
curl_easy_setopt(hCurl, CURLOPT_NOPROGRESS, 0); curl_easy_setopt(hCurl, CURLOPT_PROGRESSFUNCTION, progress_callback); curl_easy_setopt(hCurl, CURLOPT_PROGRESSDATA, this); static int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) { CLASS &obj = *(CLASS*)clientp; if (obj.exit) return 1;
source share