cURL / Mailing Lists / curl-library / Single Mail

curl-library

about dns resolve

From: bit bull <bitbull.cn_at_gmail.com>
Date: Tue, 19 Jun 2007 22:15:56 +0800

hello, I using libcurl to write a download function.but when I call
this function to down some url in first time, it show me "couldn't
resolve host name".second time and more it return OK.

what is problem? or how can I reset DNS resolve timeout?

my code piece:

bool superdown::go(const char *local, const char *remote)
{
.................
        
        curl_easy_reset(curl_handle);
        curl_easy_setopt(curl_handle, CURLOPT_URL, remote);
        curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, sd_write_data);
        curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, ofp);
        curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);

        ret = curl_easy_perform(curl_handle);
        curl_slist_free_all(slist);
............................

        if (ret)
        {
                printf(strerror, curl_easy_strerror(ret));
                return false;
        }
..........................
        return true;
}

int
main(int argc, char *argv[])
{
        superdown sd;

        sd.go("c:\\sdtest.txt", "http://p2p.dtang.tv/test/database/pb.xml");

        return 0;
}
Received on 2007-06-19