1

I am using ftp4j jar for ftp client i have used HTTP tunnel connector because my FTP server (open VMS server) is behind HTTP proxy. basic commands like PWD , NOOP , CWD are working fine , but if i try to LIST & NLIST a directory or STOR a file nothing will happen for sometime and i will get SocketTimeOutException.

below is my code

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);

while if i will comment out the part where i am adding HTTPTunnelConnector to my FTP client then my code works fine (but it will use FTPTunnelConnector i guess internally)

below is my error message java.net.SocketTimeoutException: Read timed out

Amit Kumar Lal
  • 5,537
  • 3
  • 19
  • 37

0 Answers0