commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Mercier <mmerc...@gmail.com>
Subject Timeout problem with FTPClient
Date Fri, 22 Apr 2005 14:18:24 GMT
Hi,

I am using FTPClient to connect to a remote FTP Server that seems to
be unreliable.

I have a class (FTPClientControl) that does all the necessary
initializations and has the following procedure:

   public boolean fetchFileNamed(FtpFileTableObject fileName,
FileOutputStream outStream) {
        try {
            ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
            // fileName.getFullPath() would be for ex: /home/user/subdir/myfile
            ftpClient.retrieveFile(fileName.getFullPath(), outStream);
            outStream.close();
        } catch (Exception e) {
            System.out.println(e.getLocalizedMessage());
            return false;
        }
        return true;
    }

I call the procedure by looping over a predermined list of files that
I know exist on the FTP server.  What happens, is that the app will
freeze trying to download files on occasion.  I have tried a linux
command line client as well as ws-ftp to the same server and have had
the same problems.  I though I had resolved the issue by doing a
logout and login if the above procedure returned false, but it seems
that the procedure sometimes never returns.

Is there a way to setup a timeout on the FTPClient.retrieveFile call
so that I can continue normally?

Thanks,
Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message