commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Rennick Egglestone <...@Cs.Nott.AC.UK>
Subject net - unexpected 150 when getting a file
Date Thu, 19 Aug 2004 10:37:03 GMT
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


Mime
View raw message