Reference no: EM132857888
Programming
TCP File Server
You are to write two network applications implementing a client server architecture in which client application requests a file from the server application and if the file exists in server's root directory, it is sent to the client using TCP.
Requirements
General Requirements
• The code is to be written in java and must be a console application (GUI not allowed)
• You must implement two different applications (one for client and one for server)
• You can use any IDE but final testing will be conducted through command line only
• You can only use the libraries that are packaged by default with java
• TCP must be used to initiate a connection and transfer of files
• Command line validation must be done thoroughly to check the user inputs
Server Side
• Name the Server application as "FileServer"
• You must specify the port number from the arguments while running the server. Server must print incoming client's information on the screen (IP and PORT) and requested file name.
• There must be at least 5 different files with size ranging from 1 MB to 5 MB in a folder names "Server Files" in the root (you can assume that client knows the name of files. No need to manage and send the list of files across, however, it will be cool to do so....!!!).
• Server must always be running - should not stop after serving a single client request.
Client side
• Name the Client application as "DownloadClient".
• You must specify 3 arguments
Argument 1: Port number on which client is running Argument 2: Port number on which server is running Argument 3: IP address of the server
• You must implement a simple menu on the client side that allows you to request the
server for a file.
• Application must allow to download multiple files in a single Run (program must not stop after successful transfer).
• Downloaded files must be stored in a folder in the root directory of client application with name "Server Downloaded Files"
• Client program should provide status messages that the file is getting downloaded and decrypted and when the connection to server is established or disconnected.
A sample sequence of the program from command line may look like:
Java FileServer 4000
"Server started... Local IP address is 192.168.1.1; Port 4000... waiting for clients"
"Incoming client: IP xxxxxx Port: XXXX"
"File requested: mydoc.pdf.. searching in the root..." "Starting transfer..."
"File transferred successfully!"
"Connection terminated by client"
"Server started... Local IP address is 192.168.1.1; Port 4000... waiting for clients"
Java DownloadClient 4001 4000 192.168.1.1
"Please enter the file name you wish to download: " "mydoc.pdf" "Connecting to server...."
"Connection established successfully" "Requesting the file..."
"File found on server. Starting the download" "File downloaded successfully. "
"You can check the file now." "Closing connection to server." "Successful..."
"Please enter the file name you wish to download: "
Enhancements
In the enhancement part you will send and receive a large file. The server must do the segmentation (break the large file in smaller chunks) required for large files. The received file must be saved in the client directory. The server computer will send an "end of file character" to signify the end of file. When the client detects the end-of-file marker, it will close the file and send back an acknowledgement character to the server to acknowledge receipt of the file which server shows on its screen.
Attachment:- TCP File Server - DCS Assignment.rar