Lasso Soft Inc. > Home

[ curlopt_ftpport ]

Method

[curlopt_ftpport] is used together with [curl->set]. The parameter expected by [curl->set] is a string that will be used to get the IP address to use for the FTP PORT instruction. The PORT instruction tells the remote server to connect to our specified IP address. The string may be a plain IP address, a host name, a network interface name (under Unix) or just a '-' symbol to let the library use your system's default IP address. Default FTP operations are passive, and thus won't use PORT.

The address can be followed by a ':' to specify a port, optionally followed by a '-' to specify a port range. If the port specified is 0, the operating system will pick a free port. If a range is provided and all ports in the range are not available, libcurl will report [curle_ftp_port_failed] for after trying to execute the curl operation. Invalid port/range settings are ignored.

IPv6 addresses followed by a port or portrange have to be in brackets. IPv6 addresses without port/range specifier can be in brackets. Examples with specified ports: eth0:0 192.168.1.2:32000-33000 curl.se:32123 [::1]:1234-4567.

You disable PORT again and go back to using the passive version by setting this option to [null].

  • Syntax
curlopt_ftpport
Examples
  • Beginner

To connect to a FTP server and change the port

Code

local(c = curl('ftp://ftp.sunet.se/pub/etext/'))
#c->set(curlopt_ftpport, ":4000")
#c->result

Result

0-rw-r--r--    1 14550    80          63382 Feb 12 17:28 6.pdf

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft