cURL / Mailing Lists / curl-library / Single Mail


result of curl_perform() timeout

From: Khaled El Mously <>
Date: Thu, 12 Jan 2012 16:20:40 -0500


I have this piece of code:

                curl_easy_setopt(cURL, CURLOPT_TIMEOUT, 5);
                curl_ret_status = curl_easy_perform(cURL);
                if (CURLE_OK == curl_ret_status) {
                        printf("Operation successful\n");
                } else if (CURLE_OPERATION_TIMEDOUT == curl_ret_status) {
                        printf("Operation timed out\n");

I expect the curl_ret_status to be "CURLE_OPERATION_TIMEDOUT" if curl_easy_perform() takes more than 5 seconds. However, when the operation times out, I get instead "CURLE_COULDNT_RESOLVE_HOST". Is this expected? How can one differentiate between an unresolvable host and an actual time-out?

List admin:
Received on 2012-01-12