Ftp.constructor(hostname, [username, password]) constructor


The Ftp constructor returns a Ftp value representing a FTP client and connects it to the FTP server at the given URL, using provided authentication.

Parameters

hostname

A string representing a valid hostname to connect to the FTP server. The string can contain a port, a username and password (in this case, the following parameters are not needed), with the followinf format :

ftp://username : password@hostname : port

[username]

An optional string representing the username (use "anonymous" for anonymous access if supported by the server).

[password]

An optional string representing the password (use any string for anonymous access).

Example

local net = require "net" local url = "ftp://your ftp server address" local client = net.Ftp(url, "anonymous", "guest") print("Sucessfully connected to '"..url.."'")