Establishing a connection |
To establish a connection (non-SSL) to an FTP server, create an Ftp instance and invoke the Connect method.
Example 1
In this example, the hostname, username, and password parameters are passed as arguments to the constructor.
[C#]
// create new Ftp instance and connect
Ftp myFtp = new Ftp(hostname, username, password);
myFtp.Connect();
[Visual Basic]
' create new Ftp instance and connect
Public WithEvents myFtp As Jscape.Ftp.Ftp
myFtp = New Jscape.Ftp.Ftp(hostname, username, password)
myFtp.Connect()
Example 2
In this example, the hostname, username, and password parameters are set as instance properties.
[C#]
// create new Ftp instance and connect
Ftp myFtp = new Ftp();
myFtp.HostName = "hostname";
myFtp.User = "username";
myFtp.Password = "password";
myFtp.Connect();
[Visual Basic]
' create new Ftp instance and connect
Public WithEvents myFtp As Jscape.Ftp.Ftp
myFtp = New Jscape.Ftp.Ftp()
myFtp.HostName = "hostname"
myFtp.User = "username"
myFtp.Password = "password"
myFtp.Connect()
See also
Establishing a secure connection