3
使用Apache FTPClient的代理连接到FTP服务器,我可以用下面的语句通常连接:通过使用Apache FTPClient
FTPClient client = new FTPClient();
client.connect("ftp.myhost.com");
client.login("myUsername", "myPassword");
client.changeWorkingDirectory("/fileFeed");
client.setFileType(FTPClient.BINARY_FILE_TYPE);
client.setFileTransferMode(FTPClient.BLOCK_TRANSFER_MODE);
以上工作正常,但现在我连接到FTP站点,我必须使用代理服务器。我得到的指示是我应该连接到代理服务器并在用户名中指定实际的ftp服务器。因此,要登录我会用下面的详细资料连接:
ftp ftp.myProxyServer.com
username [email protected]
password myPassword
我试图直接使用命令提示符连接,我可以连接到ftp.myProxyServer.com主机和它向前我预期的ftp站点如果我指定[email protected]作为主机用户名。问题是,上述类型的连接在Java中使用Apache FTPClient不被接受:
FTPClient client = new FTPClient();
client.connect("ftp.myProxyServer.com");
client.login("[email protected]", "myPassword");
client.changeWorkingDirectory("/fileFeed");
client.setFileType(FTPClient.BINARY_FILE_TYPE);
client.setFileTransferMode(FTPClient.BLOCK_TRANSFER_MODE);
有什么我失踪或者将上述不工作?我尝试了直接连接,并且工作正常。
'client.connect(“ftp.myProxyServer.com”);'此功能连接到FTP服务器,而不是连接到代理服务器。 – Disa
Apache VFS如何? http://commons.apache.org/vfs/api.html – theMarceloR
更改所使用的FTP库不是一个真正的选择。 – ziggy