|
Project I: Reliable Data Transfer Over Unreliable Links
Ahmet Sekercioglu and Leon Seng
|
Introduction
In this assignment, you will design and implement an application
layer protocol for reliable transfer of files between two computers
that are connected via unreliable communication links. The application
layer protocol will be using the services of a best-effort transport
layer protocol (in our case, it is UDP).
The unreliable communication links are simulated by a combination of
Mininet links and a custom Python socket (DefectiveSocket.py) as shown in
the figure below:
By modifying some parameters of the links and socket, it is possible
to change the transmission and propagation delays, and bit error rate
of the communication link to simulate various types of communication
channels that can be encountered in telecommunication systems such as
optical fiber, cellular radio channels or satellite links.
You are free to choose the protocol you wish to implement. It could be
as simple as the stop-and-wait protocol, or could be as sophisticated
as one employing forward error correction, compression on-the-fly
methods etc. The aim is to design a protocol which requires shortest
time to transfer a file, from a server to a requesting client,
completely and without errors. We are thinking about running a
competition to see who can implement the fastest file transfer
protocol.
Any working protocol which successfully transfers a file in a
reasonable time period will be given full marks.
Specifications
Client-Server Operation and Communications
You are to implement a client/server pair to perform a 'file server’
like operation. The client part of the pair requests a file from the server
as follows:
python fclient.py <server address> <server port> <requested file>
where requested file is the name of the file that it wants the server to deliver. The server
checks whether the file exists in its “current working directory”, if the file does not exist, it notifies the client
about this problem. Otherwise sends the file to the client.
Your client/server programs must meet the following specifications:
You only need to support the download operation, that is, to transfer a file from the server to
the client.
You implement your own protocol in the fclient.py and fserver.py files. Remember to comment out
the sample code before running yours!
We will test your submissions by running the client and server over the file_xfer_net mininet network by issuing
the following commands on the server and client host terminals:
server> python fserver.py <port number to listen on>, and
client> python fclient.py <server address> <server port> <requested file>
All communication must be done through the predefined sockets clientSocket and serverSocket, using their
sendto methods. The sendto method accepts a bytestring, and a tuple containing the destination
IP and port number. For example, to send packets from the server to client:
serverSocket.sendto(b“some test data”, (“172.16.0.2”, 12345))
There is no upper limit on the size of your packets. However, for efficiency, keep in mind that the packets
you create are application layer packets and may be fragmented by lower layers to fit the maximum
transmission unit (MTU) of the links.
Client Functions
Main Client function is to request a file from the server. Here are some details about its operation:
The client must be able to handle the possibility that the file does not exist on the server.
It should display a message about this problem to the user and terminate.
If the requested file exists on the server, the client will receive a copy of the requested file and
save it to the filesystem (in the /ftdownload directory) using the same name. Note that the client
does not need to support requests for files inside folders.
The client must handle the possibility that a file with the same name already exists in its /ftdownload
directory. In this case it should overwrite the existing file.
Upon successful completion of a file transfer, the client must terminate with a return value of 0.
An unsuccessful completion (for example, file does not exist on the directory that server is run) must
return a nonzero value.
Server Functions
Main Server function is to send the requested file to the client. Here are some details about its operation:
The server must be able to wait indefinitely, and keep listening for a request for a file from a client.
It should not terminate unless killed by the user.
The server must notify the client if the requested file does not exist.
Upon completion of a transfer (successful or unsuccessful) the server must return to listening for new requests.
The server needs only to handle one request at a time. It should be able to ignore requests from
other clients while a transfer is in progress.
Getting Started
Download and study the sample programs to start implementing your
client/server pair:
The client and server have the IP addresses 172.16.2.2 and
172.16.1.2 respectively. The client is configured to have a
directory /ftdownload in which downloaded files are stored.
Running the Sample Code
Test the Mininet topology by first instantiating the network:
sudo python ./file_xfer_net.py
A Mininet prompt should appear in the terminal:
mininet>
Verify the client and server connectivity by running
mininet> pingall
You should notice that the server and client are unable to ping each other. Investigate and resolve this
issue before proceeding further.
You can open separate terminal windows for the client and server by running the xterm command at the
Mininet prompt:
xterm server
xterm client
Run the sample code by starting the server in the server host terminal:
server> python fserver.py 12345
and the client from the client host terminal:
client> python fclient.py 172.16.1.2 12345 mytest.file
(Replace mytest.file with a filename which exists in the server's
current working directory.)
These commands set up the server in listening mode, and instruct the
client to send a request packet to the server. When the server
receives the request, it begins sending packets containing the string
hello back to the client continuously. Note that the sample code does
not perform any file transfers. You will write this part.
Occasionally, the string will be malformed as our custom defective
socket injects bit errors artificially. The error rate is configured
via the BYTE_ERROR_RATE variable in fserver.py.
We would suggest that you should start designing your client and
server programs by drawing state transition diagrams of the protocol
to be implemented. See the next section for further details about
further specifications of the client-server pair.
Submission and Assessment
You will upload your fclient.py and fserver.py through the unit's Moodle project submission page. No other submission methods will be accepted. Please observe these important points:
Do not submit files with different filenames: You can only submit the fclient.py and fserver.py files. Zip these two files together and upload a single .zip file please.
If no bytes of the requested file are transferred, the assignment will be graded with 0 marks.
If an incomplete transfer occurs, the assignment will get partial marks. Otherwise, for a complete and error-free transfer, full marks will be awarded.
|