You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2003/02/14 00:37:16 UTC

DO NOT REPLY [Bug 17066] New: - commons.net.FTPClient hangs on disconnect or logout

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17066>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17066

commons.net.FTPClient hangs on disconnect or logout

           Summary: commons.net.FTPClient hangs on disconnect or logout
           Product: Commons
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Net
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: jmayo@sd.seabase.com


By repetitively calling 

        try { 
            
            // connect and login to the FTP server
            ftpc.connect(getPropertyFromEnv("FTP_SERVER"));
            
            ftpc.login(getPropertyFromEnv("USERNAME"), getPropertyFromEnv
("PASSWORD"));   //technically we may have to break this into 2 blocks see 
examples

            // After connection attempt, check the reply code to verify success.
            reply = ftpc.getReplyCode();
            response = ftpc.getReplyString();

            if(!FTPReply.isPositiveCompletion(reply)) {
                System.err.println("FTP server refused connection or login.");
                killFTP(ftpc);
                ftpc = null;
            }
        } catch(IOException e) {
            System.err.println("Can't connect or login to server, reply 
= "+reply+ " response = " + response);
            killFTP(ftpc);
            ftpc = null;
        }


and then

        if (ftpc.isConnected()) {
            try {
                ftpc.logout();
            } catch (Exception e) { // do nothing 
                System.out.println("Exception in ftpc.logout()");
            }
            try {
                ftpc.disconnect();
            } catch (Exception e) { // do nothing 
                System.out.println("Exception in ftpc.disconnect()");
            }
        }

one of the two bottom calls hangs and I'm assuming that it's in an infinite
loop waiting for something that the server isn't sending.  We try and hook to
a Linux FTP server, and Windows FTP server and 99.99 % of the time it works, 
but every once in a while, it hangs and we have to kill the FTP daemon.  After 
doing that everything works again!!!

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