commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Whitlock, Jeremy x66075" <>
Subject RE: [NET] FTP logout() timeout
Date Thu, 14 Apr 2005 17:56:34 GMT
I have found in the javadoc an example of it's use and I modified my code to
come up with this:

public void saveToFTP(XMLOutputter outputter, Document doc, URL saveURL) {
    FTPClient fc = new FTPClient();
    int reply;
    try {
        reply = fc.getReplyCode();
        if(!FTPReply.isPositiveCompletion(reply)) {
	        System.err.println("FTP server refused connection.");
        fc.login("anonymous", "");
        outputter.output(doc, fc.storeFileStream(saveURL.getFile()));
        if(!fc.completePendingCommand()) {
            System.err.println("File transfer failed.");
    } catch (SocketException se) {
        System.err.println("Unable to open connection to " +
saveURL.getHost() + "!");
    } catch (IOException ioe) {
        System.err.println("Unable to to " + saveURL.getFile() + "!");
    } catch (FTPConnectionClosedException ftpcce) {
	  System.err.println("Connection closed prematurely!");

Now I get the FTPConnectionClosedException because the connection is
forcefully closed due to the FTP session timing out.  Did I implement this
wrong or is there more to my problem?  Thanks, Jeremy

-----Original Message-----
From: Whitlock, Jeremy x66075 
Sent: Thursday, April 14, 2005 11:40 AM
To: 'Jakarta Commons Users List'
Subject: RE: [NET] FTP logout() timeout 

	Thanks for the suggestion.  I'll google around for an implementation
but in the mean time, could you give me a code snippet as to how I should
use that?  Thanks, Jeremy

-----Original Message-----
From: Daniel F. Savarese []
Sent: Thursday, April 14, 2005 11:38 AM
To: Jakarta Commons Users List
Subject: Re: [NET] FTP logout() timeout 

In message <>,
t Kurniawan" writes:
>also try to do a completePendingCommand() after finishing the transfer and=
> see how it goes=0D

I hope digest lag isn't having me reply after Jeremy's already figured
it out, but completePendingCommand is exactly what's missing from the
code and why it hangs.


To unsubscribe, e-mail:
For additional commands, e-mail:

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.

View raw message