Connect to FTP Server with


Can I connect to a FTP server with program?



Yes, you can connect to a FTP server with program. But you have to know very well about the FTP protocol to be able to change directory or download files.

Here is an example of using program to connect to FTP server:

   -cp .;C:\local\commons-net-3.5\commons-net-3.5.jar
   examples.telnet.TelnetClientExample 21

Type AYT to send an AYT telnet command
Type OPT to print a report of status of options (0-24)
Type REGISTER to register a new SimpleOptionHandler
Type UNREGISTER to unregister an OptionHandler
Type SPY to register the spy (connect to port 3333 to spy)
Type UNSPY to stop spying the connection
Type ^[A-Z] to send the control character; use ^^ to send ^

220 FTP server ready

USER anonymous
331 Anonymous login ok, send your complete email address as your password
230 Anonymous access granted, restrictions apply

CWD rfc
 *                                                                    *
 * This directory is maintained by the RFC Editor.  If you experience *
 * any problems, please report them to     *
 *                                                                    *
250 CWD command successful

227 Entering Passive Mode (4,31,198,44,241,19).
   (go to another command window)
   (telnet 4,31,198,44 61715)
   (   port is calculated as 61715=241*256+19)
150 Opening ASCII mode data connection for file list
   (directory list will displayed in the other window)
226 Transfer complete


Using commons-net.jar in Java Programs

⇒⇒FAQ for Apache commons-net.jar

2017-04-08, 635👍, 0💬