You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Stefan Rennick Egglestone <sr...@Cs.Nott.AC.UK> on 2004/08/19 12:37:03 UTC
net - unexpected 150 when getting a file
Dear all
I'm trying to write code to get a file from an ftp server at
www.rfcgr.mrc.ac.uk.
I've just been following the example in the javadoc for class
org.apache.commons.net.ftp.FTPClient. This suggests that I should start
off the process (after having connected and logged-in to the server) by
doing
InputStream is = ftp.retrieveFileStream("error.log"); // error.log is
definitely a file in the directory I'm working from
if(!FTPReply.isPositiveIntermediate(ftp.getReplyCode()))
{
// something has gone wrong, so close connection
}
Now my problem is that I always get reply code 150 through. 150 is not a
positive intermediate code (these are all between 300 and 400) so I
close the connection and indicate to the user that file download has
failed. But, looking up ftp error codes, apparently 150 means
File status okay, about to open data connection.
and since it's number is between 100 and 200, then I have to wait for
another reply before proceeding with a new command. So, I was wondering
if anyone could tell me how to wait for another reply? I've tried
checking the error code repeatedly, but it never changes. I've tried
calling getReply, but this seems to block forever. What else can I do?
Thanks!
Stefan Rennick Egglestone
This message has been scanned but we cannot guarantee that it and any
attachments are free from viruses or other damaging content: you are
advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org