ftp4j中使用http代理的FTP连接的javasocket超时
我使用ftp4j jar作为ftp客户端,我使用了HTTP隧道连接器,因为我的ftp服务器(openvms服务器)位于HTTP代理之后。PWD、NOOP、CWD等基本命令运行良好,但如果我尝试列出&;列出一个目录或存储一个文件在某个时间内不会发生任何事情,我会得到SocketTimeOutException
下面是我的代码
HTTPTunnelConnector httpTunnelConnector = new HTTPTunnelConnector("**********", 80);
httpTunnelConnector.setConnectionTimeout(100);
FTPCommunicationListener ftpCommunicationListener = new FTPCommunicationListener()
{
@Override
public void sent(String command)
{
System.out.println("SENT :: "+command);
}
@Override
public void received(String response)
{
System.out.println("RECEIVED :: "+response);
}
};
FTPClient ftpClient = new FTPClient();
ftpClient.addCommunicationListener(ftpCommunicationListener);
ftpClient.setConnector(httpTunnelConnector);
System.out.println("Connecting to FTP server ... ");
String[] connectResponse = ftpClient.connect("*********", 21);
for (String string : connectResponse) {
System.out.println(string);
}
System.out.println("logging to FTP server ...");
ftpClient.login("ftpsee", "seeftp");
System.out.println("Authenticated by FTP server :: "+ftpClient.isAuthenticated());
ftpClient.setPassive(true);
File file = new File(argument);
ftpClient.upload(file);
如果我将注释掉将HTTPTunnelConnector添加到我的FTP客户端的部分,那么我的代码可以正常工作(但我想它会在内部使用FTPTunnelConnector)
下面是我的错误消息 JAVA网SocketTimeoutException:读取超时
共 (0) 个答案