I want to connect to a FTP-Server via my Servlet and I know it works, but to use it on my virtual Server I need to change the Port the servlet connects to, because the FTP-Server doesn't use the standard port.
My problem is, that I don't know how I can tell the FTPClient not to use Port 21. For example it should use Port "55555".
The FTPClient only wants one parameter, the ip, to connect.
using org.apache.commons.net.ftp
FTPClient ftp = new FTPClient();
ftp.connect("dyndns");
best SnowN
Here's the official Apache download site for Commons Net. Once you've picked and extracted the appropriate version, set a dependency in your Eclipse project: Right-click the project and choose "Properties" Choose "Java Build Path" from the resulting popup.
FTP communications use two port number values – one for commands (port 21 by default) and one for data transfer (this is where the PORT command comes into play). The PORT command is sent by an FTP client to establish a secondary connection (address and port) for data to travel over.
Apache FTPClient doesn't support SFTP at the moment.
FTPClient encapsulates all the functionality necessary to store and retrieve files from an FTP server. This class takes care of all low level details of interacting with an FTP server and provides a convenient higher level interface.
you should use method connect(host,port)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With