1CURLOPT_DNS_SERVERS(3) curl_easy_setopt options CURLOPT_DNS_SERVERS(3)
2
3
4
6 CURLOPT_DNS_SERVERS - set preferred DNS servers
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_SERVERS, char
12 *servers);
13
15 Pass a char * that is the list of DNS servers to be used instead of the
16 system default. The format of the dns servers option is:
17
18 host[:port][,host[:port]]...
19
20 For example:
21
22 192.168.1.100,192.168.1.101,3.4.5.6
23
24 The application does not have to keep the string around after setting
25 this option.
26
28 NULL - use system default
29
31 All
32
34 CURL *curl = curl_easy_init();
35 if(curl) {
36 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
37 curl_easy_setopt(curl, CURLOPT_DNS_SERVERS, "192.168.1.100:53,192.168.1.101");
38 ret = curl_easy_perform(curl);
39 curl_easy_cleanup(curl);
40 }
41
43 This option requires that libcurl was built with a resolver backend
44 that supports this operation. The c-ares backend is the only such one.
45
46 Added in 7.24.0
47
49 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
50 not, CURLE_NOT_BUILT_IN if support was disabled at compile-time,
51 CURLE_BAD_FUNCTION_ARGUMENT when given an invalid server list, or
52 CURLE_OUT_OF_MEMORY if there was insufficient heap space.
53
55 CURLOPT_DNS_LOCAL_IP4(3), CURLOPT_DNS_CACHE_TIMEOUT(3),
56
57
58
59libcurl 7.71.1 May 31, 2017 CURLOPT_DNS_SERVERS(3)