[ https://issues.apache.org/jira/browse/NET-91?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Rory Winston closed NET-91. --------------------------- > commons.net.FTPClient hangs on disconnect or logout > --------------------------------------------------- > > Key: NET-91 > URL: https://issues.apache.org/jira/browse/NET-91 > Project: Commons Net > Issue Type: Bug > Affects Versions: 1.4 Final > Environment: Operating System: All > Platform: PC > Reporter: Joe > > 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!!! -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]