Results 1 to 5 of 5
Thread: Java FTP
- 11-08-2010, 10:19 AM #1
Java FTP
Hi,
I'm an engineering student from Ireland and I'm having difficulty finding the information I need. The assignment is this:
Write a server and a client application which implements a simple file transfer protocol.
I can't even find anything to get me started on it so if anyone has any links they could send me it would be greatly appreciated.
The finer details of the assignment are as follows:
The server module should accept the following commands from the client:
server_1s : sends the list of files to the client (the content of the index.txt file)
server_put <file_name> : when the server receives this command it inserts a new entry in the index.txt containing the <file_name> and the path to a new file is opened locally using the same name (<file_name>). The server then copies all the data further received from the client in the newly created file until a null string is received.
server_get <file_name> : when the server receives this command it searches in index.txt for an entry containing the specified file name. If the corresponding entry is found the server opens the file at the specified path (corresponding to file_name in the index.txt) and sends its content to the client, otherwise the server sends a null string.
server_quit: the connection is terminated by the server.
Client:
The client should provide a command line user interface which accepts the following commands and performs the corresponding operations:
1s : sends the server_ls command to the server and then prints on the screen the list of files received from the server.
put <file_name> <file_path>: sends the server_put command to the server and then transfers the content of the file specified by the <file_path> to the server via the previously established connection.
get <file_name> <file_path>: sends the server_get command to the server and then stores the data sent by the server in the file specified by the <file_path>.
quit: sends the server_quit command to the server.
Please fill free to add any new type of message you consider to be useful in the dialog
between the server and the client to fulfil the user commands.
- 11-08-2010, 10:22 AM #2
Oh it also has to be run in the command window not using swing or applets
- 11-08-2010, 10:53 AM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,601
- Blog Entries
- 7
- Rep Power
- 17
Start by reading the API documentation for the Socket class and the ServerSocket class. If you want your server to be able to serve different clients at the same time you'll need a couple of Threads (one per client) and you have to protect some critical resources against deadlocks or deadly embrace conditions.
kind regards,
Jos
- 11-08-2010, 10:54 AM #4
Senior Member
- Join Date
- Dec 2009
- Location
- Belgrade, Serbia
- Posts
- 364
- Rep Power
- 4
I would recommend 4 step learning and working process for you:
1. Just use applications:
install free FTP server.
install free FTP client (like 'FillZila').
Configure client to connect and exchange files.
While working with files, pay attention on FTP protocol messages.
2. Study just basics of FTP protocol and messages.
3. Create java client. On this forums you will find a lot of examples (most using 'org.apache.commons.net.ftp' )
Be sure you understand passive mode, and verbose messages and debug so you can see what is going on under.
4. Start writing client and server.
When you come to #4 post your questions.
good luck!
- 11-08-2010, 11:19 AM #5


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks