Hi I've read most of the RFC on FTP (0959) and I have also searched the forum here but I am a little confused on 2 parts of making an FTP client with JAVA work. I have a connection to a server and I 'seem' to be able to talk to the FTP server correctly.. but sometimes I face the following problems. 1- I either am told by the server "password required for user 'blah'". This only happens once in awhile, and it seems at times that my program runs faster than the ftp server can keep up/process the commands sent to it. I use the following methods of talking to server..
Is there some way I Can 'wait' for the FTP Server to finish processing the first command before I sent the next one? 2 - My biggest frustration. I try issuing "STOR /path/filename.ext" and I always get a "425 Cannot build Data Connection". Important thing to note is that the directory I am in (I checked "STAT") is writeable and the file I am sending exists. Oh yeah, I issue the "STOR" command in the same way I communicate with the server above, with a wr.write(), wr.flush() and a newline for good measure. I've tried this with ASCII and IMAGE modes (EBCIDIC isn't available on this machine). The RFC's (and an article here from the 1st of November) states that you should create another 'connection', but everytime I make a seperate socket/input stream JUST for the STOR command, I get the same error. Thanks for your time.
[This message has been edited by John Bateman (edited December 09, 2000).]
Jeff Holmes was gracous enough to provide an FTPClient implementation using Sockets Here. It contains a boolean to pause until a response is recieved from the server and you'll notice that you need to create a second input stream on the socket to receive the data from a file download or a directory list. Hope this helps
Hello. I posted the address to an RFC source on your last post Sachin. Anyone else interested in FTP are welcome to take a look at and critizise my own simple (non-threaded) FTP module which can be found here: http://www.larsan.net/java/index.jsp?page=packages/network/index.html It's extremely simple, but as far as I know it work fine. Yours - Lars