Assignment #4 CS 3357a


Category: You will Instantly receive a download link for .zip solution file upon Payment


5/5 - (3 votes)

In Assignment #3 we implemented the rdt 2.2 protocol from the course textbook which allowed us to use UDP for relaible data
transfers. Unfortunately, rdt 2.2 only accounted for corrupt packets so we will need to build on our code from Assignment #3 and add a
timer to account for lost packets.
We will once again have two applications ( and using the UDP protocol to communicate across a
network that can corrupt or lose data packets. This means we have to create the reliable data transfer protocol (rdt 3.0) we saw in our
textbook by adding a timer to our client application.
The second part of this assignment will be to test your applications using the tc command to create a queing discipline. The specifics
are beyond the scope of this assignment but the basic premise is that this command allows us to introduce reordering, delays, and
losses in the channel so you can see how your applications perform.
Just to refresh your memory, below are the FSMs for both the client and server we need to create (please note ­ the server/receiver
FSM does not change from the last assignment, we still use rdt 2.2):
We will be using the following format for our Pseudo UDP packet:
ACK – Indicates if packet is ACK or not. Valid values (1 or 0)
SEQ – Sequence number of packet. Valid values (1 or 0)
DATA – Application Data (8 bytes)
CHKSUM – MD5 Checksum of packet (32 Bytes)
You will need to create the packet, load it with the necessary values and then send it to the server. The server will receive the packet,
check to see if it is corrupted and then take appropriate action. This process will exactly mirror rdt 3.0 as shown in the textbook, so
please make sure you follow it carefully!
Pictured below are four cases that your applications should be able to deal with:
To help you understand the values that would be set for communication in normal, corruption, and data loss situations please
reference the chart below:
You must create two files, and The details of each are shown below.
UDP_Client –
This app must connect to the UDP_Server app via UDP (youmust use the local loopback address of but please choose
any port number you wish) then send three separate packets containing the following information:
When adding the timer to the application, the timeout value should be set to 9ms
Remember, in order to accomplish this, the client application must also be able to receive data in the form of acknowledgements from
the server because we will be using the rdt 3.0 process for creating a reliable transfer over UDP.
UDP_Server –
This app will establish a UDP socket and listen for incoming connections from the client. When a connection is made the server will
consume the data and follow the rdt 2.2 process as shown in chapter 3 of the course textbook.
Remember, in order to accomplish this, the server application must also be able to send acknowledgements because we will be using
the rdt 2.2 process for creating a reliable transfer over UDP.
Configuring Loopback Adapter to Introduce Delays and Losses ­
To introduce packet losses and delays we will use this command:
sudo tc qdisc add dev lo root netem delay 10ms reorder 50% 50% loss 40%
This command will delay packets for 10ms (50% of the time) and lose 40% of packets. This queueing discipline runs on your loopback
adapter so you must use the loopback address in both your applications.
To revert the loopback adapter to normal behaviour run the following command:
sudo tc qdisc del root dev lo
After you have configured the loopback adapter for delays and losses you will run your applications. Keep in mind that from the
screenshots we should be able to see the lost or delayed packets based on what your applications are displaying on the screen.
The output from the UDP_Server and UDP_Client should display a line of text for each of the following actions:
Received Packet (with all packet values shown)
Packet Checksum Compare Result (ie. Corrupt or not corrupt)
Sent Packet (with all packet values shown)
Timer Expired
Other Information
I have included sample files for both UDP_Client and UDP_Server to get you started. The sample files show you how to do the
Create a UDP connection
Create a ‘pseudo UDP packet’
Calculate the checksum
Fill the packet and send it to the server
Receive the packet and unpack it
Compare checksums to ensure the packet is not corrupted
You will need to do the rest.
What to Submit
You will be submitting the following via OWL :
Files and with documentation for any command line
arguments/variables to be set, and Python Version. (We need to know how to run your app!)
Two screen captures showing
1. output messages during the session
2. output messages during the session
100 points Total
100 points Function and design of your client and server apps
You will be graded on the following:
Design and function of your applications
Documentation within your applications (Yes, it is important. No one wants to work on
undocumented apps)