How to use the active mode and the passive mode in FTPClient?
I'm trying to figure out the difference between enterLocalActiveMode()
/enterLocalPassiveMode()
and enterRemoteActiveMode(InetAddress host, int port)
/enterRemotePassiveMode()
methods of FTPClient
class from org.apache.commons.net.ftp.
I've only found some information about the difference between active and passive mode with FTP. But I don't understand the concept of local and remote previously mentioned.
The Apache Commons Net documentation (which you link yourself in the question) covers this.
In 99.9% cases, you want to use FTPClient.enterLocal*Mode
. That's for client-server transfers.
The FTPClient.enterRemote*Mode
is only for server-server transfers (aka FXP). What most FTP servers do not allow anyway.