开发者

Curl CONNECTTIMEOUT question

开发者 https://www.devze.com 2023-01-23 20:12 出处:网络
If you curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15); and 15 seconds passes and no connection is made, 开发者_开发技巧what will happen?According to this mailing list thread, the documentation for

If you curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15); and 15 seconds passes and no connection is made, 开发者_开发技巧what will happen?


According to this mailing list thread, the documentation for curl_easy_setopt and the documentation for curl_easy_perform, the call to curl_easy_perform will fail with error code CURLE_OPERATION_TIMEOUTED as defined in <curl/curl.h>.


I'd also recommend that you pass a long instead of an int. (They aren't always the same size, and curl_easy_setopt expects a long.

curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 15L);
0

精彩评论

暂无评论...
验证码 换一张
取 消