Starting from:

$30

CSCI3761 Lab 1 Simple File Transfer Services -Solved

In this programming assignment, you are to build a simple file copy service that consists of a client and server. The server and client program MUST run on separate machines.

2.1 Server 

•  A server does NOT have to handle multiple clients concurrently, but it must handle multiple clients consecutively.

•      The server will be started on a machine in a directory. That directory will be considered the HOME directory for the server.  

•      A server should support the following requests from clients: 

1.      Show files at the server’s current directory: ‘catalog’

•      Synopsis: catalog 

–        Display the all file names under current directory

•      A list of files should be sent from the server to the client and displayed on the client’s screen.

•      Hint: it is similar to ‘ls’ Unix/Linux service

2.      Download files: ‘download’

•      Synopsis: download source-filename  

–        When a server gets “download” request with “source- filename”, it checks first whether it has the requested file name under its current directory or not. If the server does not have the file, it sends an error message back to the client. Otherwise, it opens the requested file and sends it (“download”) to the client.

3.    Upload files: ‘upload’

• Synopsis: upload source-filename  

– When a server gets an “upload” request, it checks first whether it has already the same name of the requested file (dest-filename) in its current directory.  If the server has already the same name of file which was sent with “upload” request from a client, it performs “upload” service and sends the following warning message to the client for display: “‘dest-filename’ file has been overwritten”. Otherwise, it receives the file from the client and creates “dest-filename” at the current directory.
 
4.    Terminating the server: “bye”
• Synopsis: bye [no-argument]
•      When a server receives “bye” request from a client, it terminates itself with display message “File copy server is down!” and gracefully disconnect the connection with the client.

•      A server should be able to handle exceptions (errors) for each command.

•      Any error message occurred at the server should be informative and sent to and displayed to the client.

2.2 Client 

•      A client makes a connection to the server when it tries to download or upload files. You can specific the IP address for the server.  

•      A client requests following services to the server:

•      catalog, ls, download, upload, bye. 

•      Synopsis of each services refer to the description of the server

•      A client also supports following requests from the user:

1. Show files at the server’s current directory: ‘catalog’

•      Synopsis: catalog 

– Get list the all file names under current directory from the server and display the received files.

2. Download files: ‘download’

• Synopsis: download source-filename dest-filename
– When a client gets “download” request, it sends its request to the server with two arguments (source- filename and dest-filename). If the client receives an error message from the server, it displays an error message to the user without performing “download” service. Otherwise, it receives the file from the server and copies to the dest-name. If the dest-name file is already exists, the client should display the following message after the finish the ‘download’ request: “’dest- filename” has been overwritten”.

 3. Upload files: ‘upload’

• Synopsis: upload source-filename dest-filename
– When a client gets “upload” request, it checks first whether it has the requested file(source-filename) under its current directory or not. If the client does not have the request file under current directory, it displays “error” message back to the user without performing “upload” service. Otherwise, it sends its request to the connected server and performs “upload” operation. If the client receives the message about the overwriting, it displays the received the message.


4. Terminating the server: “bye”

• Synopsis: bye 

– A client sends “bye” request to the connected server and terminates itself with display message “Internet copy client is down!”.


•      A client should be able to handle exceptions (errors) for each command.

Hint: you don’t have to write entire code for the ‘catalog’  service. Your program (server or client) needs to just use (or call) a Unix/Linux service that provides the same result as your program is expected to produce such as ‘ls’.

2.3 Programming environment 

•      All programs have to be written C or C++ and run on UNIX like platform.

•      All connections between a server and clients should be TCP/IP socket.

 
2.4 Required Skills 

Everyone is expected to know following skills and knowledge in order to complete this programming assignment.

•      TCP/IP Socket programming

•      Understanding UNIX like Operating System

•      Creating/invoking processes in UNIX like environment

•      Makefile

•      C or C++


More products