File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes General Computing and the fly likes FTP using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » General Computing
Bookmark "FTP using java" Watch "FTP using java" New topic
Author

FTP using java

Aditya Sirohi
Ranch Hand

Joined: Jan 05, 2010
Posts: 93

Hello Folks,

I need to transfer file from one computer to another in the LAN. I saw some documents on FTP, can you let me how can i approach this problem? Do i need to write both client and server for this? I think if i start with a simple code that replicates file transfer using command line ( filetransfer.java C:\\test.txt [IP of the destination machine]), that would be a good start for me.

Thanks
Adi
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Who says you have to do it in Java? And why?

It's extremely unlikely that you would have to write the server in Java. If somebody says they're going to use FTP then it's extremely likely that they have an FTP server running already. Or if they don't have one, then there's one which came with their computer which they can just start up. So before you start rushing off to do something, find out what exactly you have to do and what you don't have to do.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39067
    
  23
Too difficult a question for "beginning". Moving. Maybe Java™ in General, maybe General computing . . . not sure, but let's try general computing.
Victor Ramen
Ranch Hand

Joined: Jul 14, 2008
Posts: 56
Aditya Sirohi wrote:Hello Folks,

I need to transfer file from one computer to another in the LAN. I saw some documents on FTP, can you let me how can i approach this problem? Do i need to write both client and server for this? I think if i start with a simple code that replicates file transfer using command line ( filetransfer.java C:\\test.txt [IP of the destination machine]), that would be a good start for me.

Thanks
Adi

Depends. Assuming server = source and client = destination, does the client trigger the FTP? i.e. Is it a pull mechanism? Or a push where server FTP-s without any request from the client.
In the former case, you need to write both client and server. In the latter case, only server.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I would be inclined to use a 3rd part tool/lib. so Apache Commons Net if you're going to do it programatically.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
 
GeeCON Prague 2014
 
subject: FTP using java