You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Whitlock, Jeremy x66075" <Je...@adp.com> on 2005/04/14 00:43:34 UTC

[NET] FTP logout() timeout

	I am using the FTP portion of the commons net library and I have the
following code:

public void saveToFTP(XMLOutputter outputter, Document doc, URL saveURL) {
    FTPClient fc = new FTPClient();
    int reply;
        
    try {
        fc.connect(saveURL.getHost());
            
        reply = fc.getReplyCode();
            
        if(!FTPReply.isPositiveCompletion(reply)) {
            fc.disconnect();
	      System.err.println("FTP server refused connection.");
	      System.exit(1);
	  }
            
        fc.login("anonymous", "");
            
        outputter.output(doc, fc.storeFileStream(saveURL.getFile()));
            
        fc.logout();
        fc.disconnect();
    } catch (SocketException se) {
        System.err.println("Unable to open connection to " +
saveURL.getHost() + "!");
        se.printStackTrace();
    } catch (IOException ioe) {
        System.err.println("Unable to to " + saveURL.getFile() + "!");
        ioe.printStackTrace();
    }
}

When I run this the logout process takes so long that my FTP server
disconnects it.  My FTP server acknowledges that I sent the QUIT command but
then stays connected for some reason.  Is there anything I'm doing wrong to
keep the logout process from finishing quicker?  Thanks,

Jeremy Whitlock
ADP/SIS - Programmer Analyst
4725 Independence Street
Wheat Ridge, CO 80033
Phone:  (303) 590-6075
Fax:  (303) 590-6160

_
This message and any attachments are intended only for the use of the addressee and
may contain information that is privileged and confidential. If the reader of the 
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.