curl-library
Re: error (6) : name lookup timed out
Date: Thu, 4 Dec 2008 14:25:30 +0100
> No, I was curious if you had a libcurl built to use c-ares and/or if you
> have it built to support IPv6. A "curl -V" output would show. Since you use
> the stock ubuntu version I'm pretty sure it isn't c-ares enabled.
$ curl -V
curl 7.16.4 (i486-pc-linux-gnu) libcurl/7.16.4 OpenSSL/0.9.8e
zlib/1.2.3.3libidn/1.0
Protocols: tftp ftp telnet dict ldap http file https ftps
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz
>
> I didn't see any failed system call for a resolve there.
>
> As you're (most likely) not using c-ares, libcurl is using the "plain" name
> resolver calls gethostbyname() or getaddrinfo() and if they fail I don't see
> how it can be libcurl's fault... :-O
>
Okay, here is a code that resolves hostname using gethostbyname().
http://codepad.org/jKDeSyYr
This program works, at expected, if I stop and start my internet connection.
So, at least gethostbyname() on my system works :).
http://codepad.org/NGonLKul
So, what is more likely is that my code has some subtle errors.
I see in the curl code there are global variables, and they are initialized
only on the first curl_easy_init() call. Do I need to call
curl_global_cleanup() or its friends for a clean slate during the next call
to curl_easy_init() ?
I notice each call to curl_easy_init() results in the "same" CURL*. So, I am
guessing there is some kind of reuse or "leftovers" (think global vars)
between two curl_easy_init() in the same program. In my case, maybe, it
helps to clear everything.
-- Thanks, SundararajReceived on 2008-12-04