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 *address);
12
14 Set the local IPv4 address that the resolver should bind to. The argu‐
15 ment should be of type char * and contain a single numerical IPv4 ad‐
16 dress as a string. Set this option to NULL to use the default setting
17 (do not bind to a specific IP address).
18
19 The application does not have to keep the string around after setting
20 this option.
21
23 NULL
24
26 All
27
29 CURL *curl = curl_easy_init();
30 if(curl) {
31 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
32 curl_easy_setopt(curl, CURLOPT_DNS_LOCAL_IP4, "192.168.0.14");
33 ret = curl_easy_perform(curl);
34 curl_easy_cleanup(curl);
35 }
36
38 This option requires that libcurl was built with a resolver backend
39 that supports this operation. The c-ares backend is the only such one.
40
41 Added in 7.33.0
42
44 Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if
45 not, CURLE_NOT_BUILT_IN if support was disabled at compile-time, or
46 CURLE_BAD_FUNCTION_ARGUMENT when given a bad address.
47
49 CURLOPT_DNS_INTERFACE(3), CURLOPT_DNS_LOCAL_IP6(3),
50
51
52
53libcurl 8.0.1 January 02, 2023 CURLOPT_DNS_LOCAL_IP4(3)