I'm using libcurl to communicate with Twitter and Identi.ca. Everything works perfectly as long as my connection isn't busy. But if I'm downloading a large file, the curl requests timeout after 5 seconds.
I've set the following options on the curl handle:
curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 60);
curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 15);
and they make no difference, curl_easy_perform() always returns after 5 seconds. The CURLINFO_RESPONSE_CODE and CURLINFO_HTTP_CONNECTCODE values are always both zero.
Any ideas? Are there any other timeouts I need to set, or is there any reason why the above don't take effect?
EDIT: The return value of curl_easy_perform is CURLE_OPERATION_TIMEDOUT
I'd say it is because one out of two reasons:
You don't show us the complete program here so you have a set timeout option somewhere else that instructs libcurl to timeout.
Your libcurl version has a bug that makes it misbehave. You didn't say which libcurl version on what platform you're using.
To get really good help, provide a complete source code that repeats the problem against a public URL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With