1CURLOPT_INTERFACE(3)       curl_easy_setopt options       CURLOPT_INTERFACE(3)
2
3
4

NAME

6       CURLOPT_INTERFACE - source interface for outgoing traffic
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_INTERFACE, char *inter‐
12       face);
13

DESCRIPTION

15       Pass a char * as parameter. This sets the interface name to use as out‐
16       going  network  interface.  The  name  can  be an interface name, an IP
17       address, or a host name.
18
19       If the parameter starts with "if!" then it is treated as only as inter‐
20       face  name  and  no  attempt will ever be named to do treat it as an IP
21       address or to do name resolution on it.  If the parameter  starts  with
22       "host!" it is treated as either an IP address or a hostname.  Hostnames
23       are resolved synchronously.  Using the if! format is highly recommended
24       when  using  the  multi interfaces to avoid allowing the code to block.
25       If "if!" is specified but the parameter  does  not  match  an  existing
26       interface, CURLE_INTERFACE_FAILED is returned from the libcurl function
27       used to perform the transfer.
28
29       libcurl does not support using network interface names for this  option
30       on Windows.
31
32       The  application  does not have to keep the string around after setting
33       this option.
34

DEFAULT

36       NULL, use whatever the TCP stack finds suitable
37

PROTOCOLS

39       All
40

EXAMPLE

42       CURL *curl = curl_easy_init();
43       if(curl) {
44         curl_easy_setopt(curl, CURLOPT_URL, "http://example.com/foo.bin");
45
46         curl_easy_setopt(curl, CURLOPT_INTERFACE, "eth0");
47
48         ret = curl_easy_perform(curl);
49
50         curl_easy_cleanup(curl);
51       }
52

AVAILABILITY

54       The "if!" and "host!" syntax was added in 7.24.0.
55

RETURN VALUE

57       Returns CURLE_OK on success or CURLE_OUT_OF_MEMORY if there was  insuf‐
58       ficient heap space.
59

SEE ALSO

61       CURLOPT_SOCKOPTFUNCTION(3), CURLOPT_TCP_NODELAY(3),
62
63
64
65libcurl 7.66.0                   June 18, 2018            CURLOPT_INTERFACE(3)
Impressum