1--- 2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_IPRESOLVE 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_HTTP_VERSION (3) 9 - CURLOPT_RESOLVE (3) 10 - CURLOPT_SSLVERSION (3) 11--- 12 13# NAME 14 15CURLOPT_IPRESOLVE - IP protocol version to use 16 17# SYNOPSIS 18 19~~~c 20#include <curl/curl.h> 21 22CURLcode curl_easy_setopt(CURL *handle, CURLOPT_IPRESOLVE, long resolve); 23~~~ 24 25# DESCRIPTION 26 27Allows an application to select what kind of IP addresses to use when 28establishing a connection or choosing one from the connection pool. This is 29interesting when using host names that resolve to more than one IP family. 30 31If the URL provided for a transfer contains a numerical IP version as a host 32name, this option does not override or prohibit libcurl from using that IP 33version. 34 35Available values for this option are: 36 37## CURL_IPRESOLVE_WHATEVER 38 39Default, can use addresses of all IP versions that your system allows. 40 41## CURL_IPRESOLVE_V4 42 43Uses only IPv4 addresses. 44 45## CURL_IPRESOLVE_V6 46 47Uses only IPv6 addresses. 48 49# DEFAULT 50 51CURL_IPRESOLVE_WHATEVER 52 53# PROTOCOLS 54 55All 56 57# EXAMPLE 58 59~~~c 60int main(void) 61{ 62 CURL *curl = curl_easy_init(); 63 if(curl) { 64 CURLcode res; 65 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin"); 66 67 /* of all addresses example.com resolves to, only IPv6 ones are used */ 68 curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V6); 69 70 res = curl_easy_perform(curl); 71 72 curl_easy_cleanup(curl); 73 } 74} 75~~~ 76 77# AVAILABILITY 78 79Always 80 81# RETURN VALUE 82 83Returns CURLE_OK 84