cURL / Mailing Lists / curl-library / Single Mail


Strange "couldn't connect to host" error

From: Jonathan Arnold <>
Date: Thu, 31 May 2007 15:42:30 -0400

We have a routine that gets called every second, goes out to the web,
and downloads a tiny (about 50 characters) file. It runs okay for
some random time, say 30 minutes, but then returns back a "Couldn't
connect to host" error. If I stop it in the debug, and move back the
current statement and just retry the Curl_PerformHttp call, it
works just fine. This is on Windows (XP in my case). The timer code
is pretty straightforward:

     std::string new_timestamp;
     curl_easy_setopt(curl_, CURLOPT_WRITEDATA, (void *)&new_timestamp);
     curl_easy_setopt( curl_, CURLOPT_WRITEFUNCTION, WriteStringCallback );

     std::string urlstr = (pixurl+"");
     curl_easy_setopt(curl_, CURLOPT_URL, urlstr.c_str() );

     if ( PerformHttp() )

Should I tweak some timeout?

Jonathan Arnold           Software Engineer
inSORS Integrated Communications, Inc Office/fax: 781.391.2818
Received on 2007-05-31