简体   繁体   English

Apache Commons Net FTPClient 默认使用被动模式还是主动模式?

[英]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.我正在使用的应用程序使用来自 Apache Commons Net 的FTPClient类来连接文件并将文件传输到 FTP 服务器。 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: FTPClient构造函数的文档说:

Default FTPClient constructor.默认 FTPClient 构造函数。 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 .创建一个新的 FTPClient 实例,数据连接模式设置为ACTIVE_LOCAL_DATA_CONNECTION_MODE ,文件类型设置为FTP.ASCII_FILE_TYPE ,文件格式设置为 FTP.NON_PRINT_TEXT_FORMAT ,文件结构设置为FTP.FILE_STRUCTURE ,传输模式设置为FTP.STREAM_TRANSFER_MODE .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM