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

NAME

6       CURLOPT_FTPPORT - make FTP transfer active
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTPPORT, char *spec);
12

DESCRIPTION

14       Pass  a  pointer to a null-terminated string as parameter. It specifies
15       that the FTP transfer will be made actively and the given  string  will
16       be used to get the IP address to use for the FTP PORT instruction.
17
18       The  PORT  instruction tells the remote server to connect to our speci‐
19       fied IP address. The string may be a plain IP address, a host  name,  a
20       network interface name (under Unix) or just a '-' symbol to let the li‐
21       brary use your system's default IP address. Default FTP operations  are
22       passive, and thus will not use PORT.
23
24       The address can be followed by a ':' to specify a port, optionally fol‐
25       lowed by a '-' to specify a port range.  If the port  specified  is  0,
26       the operating system will pick a free port.  If a range is provided and
27       all  ports  in  the  range  are  not  available,  libcurl  will  report
28       CURLE_FTP_PORT_FAILED  for the handle.  Invalid port/range settings are
29       ignored.  IPv6 addresses followed by a port or portrange have to be  in
30       brackets.  IPv6 addresses without port/range specifier can be in brack‐
31       ets.
32
33       Examples with specified ports:
34
35         eth0:0
36         192.168.1.2:32000-33000
37         curl.se:32123
38         [::1]:1234-4567
39
40       You disable PORT again and go back to using the passive version by set‐
41       ting this option to NULL.
42
43       The  application  does not have to keep the string around after setting
44       this option.
45

DEFAULT

47       NULL
48

PROTOCOLS

50       FTP
51

EXAMPLE

53       CURL *curl = curl_easy_init();
54       if(curl) {
55         curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/old-server/file.txt");
56         curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");
57         ret = curl_easy_perform(curl);
58         curl_easy_cleanup(curl);
59       }
60

AVAILABILITY

62       Port range support was added in 7.19.5
63

RETURN VALUE

65       Returns CURLE_OK if the option is  supported,  CURLE_UNKNOWN_OPTION  if
66       not, or CURLE_OUT_OF_MEMORY if there was insufficient heap space.
67

SEE ALSO

69       CURLOPT_FTP_USE_EPRT(3), CURLOPT_FTP_USE_EPSV(3),
70
71
72
73libcurl 7.82.0                 November 26, 2021            CURLOPT_FTPPORT(3)
Impressum