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