How to connect to FTP over TLS/SSL (FTPS) server in Java

扶醉桌前 提交于 2019-11-30 13:34:19

The SimpleFTP class/library does not support TLS/SSL at all.


Use the FTPSClient class from the Apache Commons Net library instead.

See the official example for the FTPClient class and just substitute the FTPClient with the FTPSClient.

FTPSClient ftpClient = new FTPSClient();
ftpClient.connect(host);
ftpClient.login(user, password);

The FTPSClient class defaults to an explicit TLS/SSL (recommended). In a rare case you need an implicit TLS/SSL, use new FTPSClient(true).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!