cURL / Mailing Lists / curl-library / Single Mail

curl-library

result of curl_perform() timeout

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

Hello

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?

Thanks
-Khaled
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-12