View the step-by-step solution to:

Question


The project requires three pieces of work: a network protocol

specification, a client program that implements the client side of the protocol, and a server program that implements the server side of the protocol.

Project 2: A Simple File Transfer Protocol


Design and implement a simple network protocol that can be used to download files from a remote site and upload files to a remote site, and a client and a server program that communicate using that protocol. The protocol should use TCP as its transport layer protocol. The server must be able to serve multiple client requests simultaneously. For simplicity, do not consider any authentication process in this project, hence the server will provide its service to any client with the right site address and port number.


To simplify project marking, please name your server program myftpd with the following command line syntax (here the letter d in myftpd stands for daemon, since the server should run as a daemon process:


myftpd [ initial_current_directory ]


The server process maintains a current directory. Its initial value should be the one inherited from its parent process unless the optional:


initial_current_directory


is given. In the latter case, the user supplied path should be used to set the initial current directory of the server. This can be done using the function chdir. A client can use the cd command to change the (child) server's current directory later.


The client program should be named myftp with the following command line syntax:


myftp [ hostname | IP_address ]


where the optional hostname (IP_address) is the name (address) of the remote host that provides the myftp service. If the hostname or IP_address is omitted, the local host is assumed.


After the connection between the client and the server is established, the client should display a prompt > and wait for one of the following commands:


pwd - to display the current directory of the server that is serving the client;

lpwd - to display the current directory of the client;

dir - to display the file names under the current directory of the server that is serving the client;

ldir - to display the file names under the current directory of the client;

cd directory_pathname - to change the current directory of the server that is serving the client; Must support "." and ".." notations.

lcd directory_pathname - to change the current directory of the client; Must support "." and ".." notations.

get filename - to download the named file from the current directory of the remote server and save it in the current directory of the client;


put filename - to upload the named file from the current directory of the client to the current directory of the remove server.

quit - to terminate the myftp session.




The myftp client should repeatedly display the prompt and wait for a command until the quit command is entered.


This project consists of three components:


1. Protocol Specification:


You must specify a protocol for communication between the myftp client and the myftp server. This protocol will become the sole reference to which the client program and the server program can be separately implemented. This means that, by referring to the protocol, the client and server can be implemented independently of each other. The design and implementation of the client (server) should not depend on (1) what strategy and algorithms were used to implement the server (client), (2) what programming language were used to implement the server (client), and (3) what operating system the server (client) is running on. The protocol must be complete, i.e., it must contain all the necessary information required by both parties to communicate, such as the format and sequence of data exchanges between the client and the server, the transport layer protocol used to deliver the data, and the server port number. However, it should not contain anything that unnecessarily constrains the implementation of the client or the server. For example, there is no point in limiting the implementation language to a particular programming language in the protocol, or to require the client or the server to be implemented with a particular data structure.


Before you attempt this project, you should first complete the first two exercises in Lab 11. You may also read the Trivial FTP Protocol given in Appendix 17A of the textbook (Stallings: Chapter 17 of Online Chapters). Note TFTP uses UDP, while myftp protocol must use TCP.


  1. Client Program:


You need to implement a client program according to the myftp protocol. Note that the client should never rely on any undocumented internal tricks in the server implementation. Apart from the myftp protocol, you should not make any other assumption about the server program in your client program.


  1. Server Program:


You need to implement a server program according to the myftp protocol. Note that the server should never rely on any undocumented internal tricks in the client implementation. Apart from the myftp protocol, you should not make any other assumption about the client program in your server program.


Note the following additional requirements/explanations:


The name of the client executable program must be myftp. The name of the server executable program must be myftpd.


To avoid potential conflict in the use of the server's "well known" port number when several students use the CETO server, you should use the TCP port allocated to you as the default server listening port.

Tests should show the cases where both the client and the server are on the same machine as well as on different machines (you may want to use ceto.murdoch.edu.au to do the testing, however you must kill your server at the end of the test). They should also show that more than one client can obtain theservice at the same time. When debugging your network program on a standalone machine (e.g., on your home Linux), you may use localhost as the "remote" host name.


Tests should show that the program can transfer not only small files (e.g., 0, 10 and 100 bytes) but also large files (at least several MB), and not only text files but also binary files. In addition, you must show that the transferred file and the original file are identical not only in their sizes but also in their contents (use diff command).

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes