cURL / Mailing Lists / curl-library / Single Mail


Re: Strange "couldn't connect to host" error

From: Jonathan Arnold <>
Date: Fri, 01 Jun 2007 09:28:18 -0400

Daniel Stenberg wrote:
> On Thu, 31 May 2007, Jonathan Arnold wrote:
>>>> We have a routine that gets called every second, goes out to the
>>>> web, and downloads a tiny (about 50 characters) file.
>> curl, v7.16.2 Yes, it downloads from the same server.
> Ok, but isn't then the same single connection being re-used all the
> time? What is the difference after 30 minutes? (1800 fetches!)

I'm not sure, but I guess so. I call Curl_Init once when the dialog box
gets created, and then the timer uses the same handle to do the http
perform. And it isn't always 30 minutes, just something like that. And
it doesn't happen for everyone. For me (luckily really) and a few select

>>>> It runs okay for some random time, say 30 minutes, but then returns
>>>> back a "Couldn't connect to host" error.
> For how long? I mean does it fail once and work the next attempt again?

Not sure what you mean by "how long", but yes, it works again in two differenct

1] When we get the error, we do a cleanup and then re-init and it works fine.

2] If I stop it in the debugger after it gets the error, reset the current
instruction back to the first easy_setopt and re-run, it works fine too.

Should I do a curl_easy_init / curl_easy_cleanup inside the timer, instead of
just once?

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