blob: 8a99d974452cf49075370b10cf64e55b52f9cec8 [file] [log] [blame]
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07001.\" **************************************************************************
2.\" * _ _ ____ _
3.\" * Project ___| | | | _ \| |
4.\" * / __| | | | |_) | |
5.\" * | (__| |_| | _ <| |___
6.\" * \___|\___/|_| \_\_____|
7.\" *
Elliott Hughes82be86d2017-09-20 17:00:17 -07008.\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -07009.\" *
10.\" * This software is licensed as described in the file COPYING, which
11.\" * you should have received as part of this distribution. The terms
Alex Deymo8f1a2142016-06-28 14:49:26 -070012.\" * are also available at https://curl.haxx.se/docs/copyright.html.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070013.\" *
14.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15.\" * copies of the Software, and permit persons to whom the Software is
16.\" * furnished to do so, under the terms of the COPYING file.
17.\" *
18.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19.\" * KIND, either express or implied.
20.\" *
21.\" **************************************************************************
22.\"
Elliott Hughes1ef06ba2018-05-30 15:43:58 -070023.TH CURLOPT_FTPPORT 3 "May 30, 2017" "libcurl 7.60.0" "curl_easy_setopt options"
Elliott Hughes82be86d2017-09-20 17:00:17 -070024
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070025.SH NAME
26CURLOPT_FTPPORT \- make FTP transfer active
27.SH SYNOPSIS
28#include <curl/curl.h>
29
30CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTPPORT, char *spec);
31.SH DESCRIPTION
32Pass a pointer to a zero terminated string as parameter. It specifies that the
33FTP transfer will be made actively and the given string will be used to get
34the IP address to use for the FTP PORT instruction.
35
36The PORT instruction tells the remote server to connect to our specified IP
37address. The string may be a plain IP address, a host name, a network
38interface name (under Unix) or just a '-' symbol to let the library use your
39system's default IP address. Default FTP operations are passive, and thus
40won't use PORT.
41
42The address can be followed by a ':' to specify a port, optionally followed by
43a '-' to specify a port range. If the port specified is 0, the operating
44system will pick a free port. If a range is provided and all ports in the
45range are not available, libcurl will report CURLE_FTP_PORT_FAILED for the
46handle. Invalid port/range settings are ignored. IPv6 addresses followed by
47a port or portrange have to be in brackets. IPv6 addresses without port/range
48specifier can be in brackets.
49
50Examples with specified ports:
51
52.nf
53 eth0:0
54 192.168.1.2:32000-33000
55 curl.se:32123
56 [::1]:1234-4567
57.fi
58
59You disable PORT again and go back to using the passive version by setting
60this option to NULL.
Elliott Hughes82be86d2017-09-20 17:00:17 -070061
62The application does not have to keep the string around after setting this
63option.
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070064.SH DEFAULT
65NULL
66.SH PROTOCOLS
67FTP
68.SH EXAMPLE
Elliott Hughes82be86d2017-09-20 17:00:17 -070069.nf
70CURL *curl = curl_easy_init();
71if(curl) {
72 curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/old-server/file.txt");
73 curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");
74 ret = curl_easy_perform(curl);
75 curl_easy_cleanup(curl);
76}
77.fi
Bertrand SIMONNETe6cd7382015-07-01 15:39:44 -070078.SH AVAILABILITY
79Port range support was added in 7.19.5
80.SH RETURN VALUE
81Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
82CURLE_OUT_OF_MEMORY if there was insufficient heap space.
83.SH "SEE ALSO"
84.BR CURLOPT_FTP_USE_EPRT "(3), " CURLOPT_FTP_USE_EPSV "(3), "