How to connect to an FTP server

Connecting to an FTP server with edtFTPj/PRO is simply a matter of:

1.    Creating an FTPClient object

FTPClient ftp = new FTPClient();

2.    Setting the remote host

ftp.setRemoteHost(host);

3.    Calling the connect() method.

ftp.connect();

4.    Logging in.

ftp.login(username, password);

4.    Logging out and closing the connection.

ftp.quit();


The connect() call will return when it's successfully connected, or throw an exception if it fails to connect. Similarly, the login() call will return when successfully logged into the server.