Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.4k views
in Java FTP by (160 points)
Hello,

I have written a small test applicateion for a first test of etdftpj.
I works, but I have a problem, when using a proxy.

First this is my program:
      FTPClient client = new FTPClient();
      client.setConnectMode(FTPConnectMode.PASV);
      client.setRemoteHost(remoteHost);      
      client.connect();
      client.setDetectTransferMode(true);      

      if (client.connected()) {
        System.out.println("Connected");
        // login to server
        client.login(username, password);
        System.out.println("Logged in");
        // set locale information
        client.setParserLocale(java.util.Locale.US);
        // list files
        FTPFile[] files = client.dirDetails("inbound");
        for (int i=0; i< files.length; i++) {
          FTPFile cf = files[i];
          if (!cf.isDir()) {
            System.out.println("Getting "+cf.getName()+" "+new Date());
            client.setType(FTPTransferType.ASCII);
            client.get("c:\\"+cf.getName(), "inbound/"+cf.getName());
          }
        }
      } else System.err.println("Cannot connect to server");


If remoteHost = proxyHost and Username = user@host I get the following result:
2006-10-19 11:22:41 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: ---> TYPE A
2006-10-19 11:22:43 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: 200 Type set to A
2006-10-19 11:22:43 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: ---> PASV
2006-10-19 11:22:43 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: 227 Entering Passive Mode (217,115,67,71,170,1)
2006-10-19 11:22:43 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: ---> RETR inbound/readme.txt
2006-10-19 11:22:43 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: 150 File status okay; about to open data connection.
2006-10-19 11:25:44 DEBUG com.enterprisedt.net.ftp.FTPClient: Transferred 3188 bytes from remote host
2006-10-19 11:25:44 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: 226 Transfer complete.


So the is a huge delay when opening the data connection.


If remoteHost = host and username = user (so no proxy is used), the connection is fine, no delay
2006-10-18 23:56:57 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: ---> TYPE A
2006-10-18 23:56:57 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: 200 Type set to A
2006-10-18 23:56:57 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: ---> PASV
2006-10-18 23:56:57 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: 227 Entering Passive Mode (212,204,60,12,254,153).
2006-10-18 23:56:57 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: ---> RETR inbound/readme.txt
2006-10-18 23:56:57 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: 150 Opening ASCII mode data connection for inbound/readme.txt (3119 bytes)
2006-10-18 23:56:57 DEBUG com.enterprisedt.net.ftp.FTPClient: Transferred 3188 bytes from remote host
2006-10-18 23:56:57 DEBUG com.enterprisedt.net.ftp.FTPControlSocket: 226 Transfer complete.


I have tested the same with a "normal" ftp client application - everything is fine, so I can donwload the file without any delays. So the proxy server does not cause this problem.

Has anyone an idea, where to search for the problem?

Thanks for your help!

Regards
Joern

3 Answers

0 votes
by (162k points)
Many clients use active mode - maybe you should try that?
0 votes
by (160 points)
The applicatieon I used was set to passive mode as well. I just double checked with edtftpj and ACTIVE. Same result - the delays still exists.
0 votes
by (162k points)
Weird. Make sure there are no SOCKS settings set in edtFTPj, that could interfere.

Another possibility is a misconfigured DNS - Java seems to have problems in this area - things can get very slow. Try using the proxy IP address instead of hostname to test this.

Categories

...