Starting from:

$30

CS69012-Assignment 3 File Transfer Protocol Design Solved

In this assignment you need to implement file transfer protocol on top of TCP sockets.  There will be a server and multiple clients communicating with the server. Each client process will open a new connection with the server. Use select to handle multiple client requests.

 

FTP Commands and there functionality 
 

1.     RETR : This command causes the remote host to initiate a data connection and to send the requested file over the data connection.

2.     STOR : This command causes to store a file into the current directory of the remote host.

3.     LIST : Sends a request to display the list of all files present in the directory.

4.     ABOR : This command tells the server to abort the previous FTP service command and any associated transfer of data.

5.     QUIT : This command terminates a USER and if file transfer is not in progress , the server closes the control connection.

6.     DELE : This command deletes a file in the current directory of server.

 

Problem
 

Write two separate C programs one for TCP server (handles requests from multiple servers) and one for client.

Your server program will use the SELECT system call to handle multiple clients. Multiple clients should be simultaneously able to communicate with the server.  

You need to implement file transfer protocol between server and client. You should assume the files data structure to be ‘FILE STRUCTURE’ (i.e. file as a contiguous stream of bytes without internal structure). You may have a single process to handle both control and data communication, at server and client.

 

Working of server and client is as follows:

1.     Server accepts connections from clients.

2.     Server receives control information like FTP commands over this connection.

3.     Server checks for valid commands, and executes them if there is no error.

4.     Server creates a new data connection with the client for sending data information.

Only one file can be sent over one data connection.

5.     The same  control connection remains active throughout the user session.

6.     Client receives the response and displays it to the user.

 

Implement the following ftp commands: 

1.     RETR <filename  

2.     STOR <filename

3.     LIST  

4.     ABOR

5.     QUIT

6.     DELE <filename  

 

Sample Scenario 
 

Server
Client 1
Client 2
./server 500
 
 
Server running
 
 
 
./client 127.0.0.1 500
 
Connected to client 1
Connected to server
 
 
LIST
 
LIST command received from client 1
 
 
Sending list of files to client 1
A.txt B.txt
 
 
 
./client 127.0.0.1 500
Connected to client 2
 
Connected to server
 
 
RETR A.txt
RETR command received from client 2
 
 
Sending file A.txt to client 2
 
 
 
 
Received file A.txt
 
QUIT
 
QUIT command received from client 1
 
 
Client 1 disconnected
Disconnected from server
 
 
 
QUIT
QUIT command received from client 2
 
 
Client 2 disconnected
 
Disconnected from
 
 
server

More products