Skip to content

Does Apache Commons Net FTPClient use passive or active mode by default?

The app I’m working with uses FTPClient class from Apache Commons Net to connect and transfer files to a FTP server. I’m trying to establish if it’s doing that in a passive or active mode by default and I can’t see any references in the app’s code or in the library itself.

Any ideas?


The active mode is the default.

Documentation for FTPClient constructor says:

Default FTPClient constructor. Creates a new FTPClient instance with the data connection mode set to ACTIVE_LOCAL_DATA_CONNECTION_MODE , the file type set to FTP.ASCII_FILE_TYPE , the file format set to FTP.NON_PRINT_TEXT_FORMAT , the file structure set to FTP.FILE_STRUCTURE , and the transfer mode set to FTP.STREAM_TRANSFER_MODE .