commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knepp, Ethan" <eKn...@c-cor.net>
Subject [NET] FTPClient - retrieveFile() never returns
Date Fri, 16 Jul 2004 14:23:17 GMT
Background:
I have been using Commons/Net's FTPClient for about 9 months now.  Its
awesome!  I am utilizing the retrieveFile(String string, OutputStream
outputStream) method for retrieving files.  I am retrieving zip files (avg
1MB in size) on a periodic (15min) basis and storing them on localhost
(Solaris 8) for further processing.  These zip files are generated and
stored by another company on a remote FTP Server (Windows).  

Here is my wrapper around the FTPClient's(ftpConn) retrieveFile():

    public boolean retrieveFile(String fileName, OutputStream fileOutput) {
        boolean fileRetrieved = false;

        if (!ftpConn.isConnected()) {
            this.reconnect();
        }

        if (ftpConn.isConnected()) {

            try {

                fileRetrieved = ftpConn.retrieveFile(fileName, fileOutput);

            } catch (IOException ioe) {

                log.warn("FTPUtil - retrieveFile(): ", ioe);

            }

        }

        return fileRetrieved;
    }

Problem:
Recently my process that is retrieving the zip file seems to hang at
'fileRetrieved = ftpConn.retrieveFile(fileName, fileOutput);'.  If it
entered the 'this.reconnect()' I would see log messages stating entry, but I
don't so its not entering that method.  I don't see a IOException being
throw and the method never returns.  It isn't hanging on a regular basis
either, sometimes it takes 1 -2 days to occur.  The most recent encounter
was 6 days before a hang was encountered.  I see that the zip file is being
created locally from the outputStream, but it remains at 0K in size even
through the server file is 1MB.  

I also performed the following after a hang has occured:
'netstat -a | grep remoteservername' 
tcp        0      0 192.168.130.98:35717    remoteservername:ftp ESTABLISHED

Does anyone have any ideas?

Thanks,
Ethan


----
Ethan Knepp
Software Engineer
C-COR Incorporated
www.c-cor.net 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message