1CURLOPT_DNS_LOCAL_IP4(3) curl_easy_setopt options CURLOPT_DNS_LOCAL_IP4(3)
2
3
4
6 CURLOPT_DNS_LOCAL_IP4 - IPv4 address to bind DNS resolves to
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DNS_LOCAL_IP4, char
12 *address);
13
15 Set the local IPv4 address that the resolver should bind to. The argu‐
16 ment should be of type char * and contain a single numerical IPv4
17 address as a string. Set this option to NULL to use the default set‐
18 ting (don't bind to a specific IP address).
19
20 The application does not have to keep the string around after setting
21 this option.
22
24 NULL
25
27 All
28
30 CURL *curl = curl_easy_init();
31 if(curl) {
32 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
33 curl_easy_setopt(curl, CURLOPT_DNS_LOCAL_IP4, "192.168.0.14");
34 ret = curl_easy_perform(curl);
35 curl_easy_cleanup(curl);
36 }
37
39 This option requires that libcurl was built with a resolver backend
40 that supports this operation. The c-ares backend is the only such one.
41
42 Added in 7.33.0
43
45 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
46 not, CURLE_NOT_BUILT_IN if support was disabled at compile-time, or
47 CURLE_BAD_FUNCTION_ARGUMENT when given a bad address.
48
50 CURLOPT_DNS_INTERFACE(3), CURLOPT_DNS_LOCAL_IP6(3),
51
52
53
54libcurl 7.71.1 December 10, 2017 CURLOPT_DNS_LOCAL_IP4(3)