commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Wynter" <da...@roamware.co.uk>
Subject RE: [NET] FTPClient - retrieveFile() never returns
Date Mon, 26 Jul 2004 15:00:17 GMT
Hi Ethan,

I too am having a similar problem. But I have an additional exception caught
too
	                } catch (FTPConnectionClosedException e)

But this is not thrown either. The ftpclient just sits there for hours. It
is not something that is easy to debug because it happens so infrequently.

Did you get around it?

My thoughts are to add another thread to timeout on and then to the listener
a method for killing the current connection.

David

-----Original Message-----
From: Knepp, Ethan [mailto:eKnepp@c-cor.net]
Sent: 16 July 2004 15:23
To: 'commons-user@jakarta.apache.org'
Subject: [NET] FTPClient - retrieveFile() never returns


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


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