You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Bindul Bhowmik (GMail)" <bi...@gmail.com> on 2005/04/14 17:22:39 UTC
Re: FTP logout() timeout
This is something I remember while experimenting with an FTP server a
few years back, it does not accept null as a valid password for the
anonymous user. I think I was working on the FTP server that came with
Red Hat Linux 6 (don't remember exactly.)
Try passing some password (any string) with the username, instead of
"" in fc.login("anonymous", "");
On 4/14/05, Kurt Kurniawan <kk...@bigw.com.au> wrote:
>
> I'm using FTP as well. I don't see anything wrong with your code.
>
> I think the best thing to do is to compare with
> the normal behaviour as you connect to the FTP from your command line.
>
> Does it also timed out if you connect to FTP server from command line?
> also try to do a completePendingCommand() after finishing the transfer and
> see how it goes
>
>
> regards,
>
> Kurt Kurniawan
> Enterprise Application Integration
> Senior Analyst/Programmer
> Big W
> Australia
>
>
> -----Original Message-----
> From: Whitlock, Jeremy x66075 [mailto:Jeremy_Whitlock@adp.com]
> Sent: Thursday, 14 April 2005 8:44 AM
> To: commons-user@jakarta.apache.org
> Subject: [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);
> }
>
> c
>
> 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.
>
> CAUTION: This message may contain confidential information intended only for
> the use of the addressee named above. If you are not the intended
> recipient of this message, any use or disclosure of this message is
> prohibited. If you received this message in error please notify email
> Administrators immediately. You must obtain all necessary intellectual
> property clearances before doing anything other than displaying this message
> on your monitor. There is no intellectual property licence. Any views
> expressed in this message are those of the individual sender and may not
> necessarily reflect the views of BIG W Discount Stores.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org