This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

FTPing with Java  RSS feed

 
John Bateman
Ranch Hand
Posts: 320
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
sachin patel
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Carl or John.
can you please tell me where to find
the RFC on FTP (0959)
Thanks

------------------
Sachin,
****************************************************
Learn from others mistakes. Life is too short to make all yourself.
****************************************************
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!