We will create two applications (UDP_Client.py and UDP_Server.py) using the UDP protocol to communicate across a network that can corrupt or lose data packets. This means we have to implement the reliable data transfer protocol (rdt 3.0) we saw in our textbook.
The second part of this assignment will be to test your applications by introducing checksum corruption, delays, and losses in the channel so you can see how your applications perform.
Below are the FSMs for both the client(sender) and server(receiver) we need to create (please note – the server/receiver FSM uses rdt 2.2 as there is no need to define a new rdt 3.0 for it):
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, UDP_Client.py and UDP_Server.py. The details of each are shown below.
This app must connect to the UDP_Server app via UDP (you must use the local loopback address of 127.0.0.1 but please choose any port number you wish) then send three separate packets containing the following information:
When implementing the timer in the Client.py 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.
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.
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
Run your Client and Server Applications and capture the exchange of information between them, you must submit two screenshots for this part.
PART B – Introduce ACK Corruption, Delays, and Losses from the Server Side
To introduce packet losses and delays you will need to include some functions to mimic this behaviour within your server code. Below are three example functions that introduce Corruption, Delays, and Losses. You can use these as is or implement your own.
if True and random.choice([0,1,0]) == 1: # Set to False to disable Network Delay. Default is 33% packets are delayed
if True and random.choice([0,1,1,0]) == 1: # Set to False to disable Network Loss. Default is 50% packets are lost
if True and random.choice([0,1,0,1]) == 1: # # Set to False to disable Packet Corruption. Default is 50% packets are corrupt
You will be delaying server ACKs, corrupting server ACKs, and losing Server ACKs to simulate an unreliable channel. Once you have implemented these functions you will need to run your applications and show an exchange that demonstrates all three conditions (Corruption, Delay, and Loss) by submitting two screenshots (one of the Client side and one of the Server side).
Keep in mind that from the screenshots we should be able to see the corrupt, delayed, and lost ACKs based on what your applications are displaying on the screen.
- 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 UDP_Server.py and UDP_Client.py
- Four screen captures showing
- PART A– UDP_Client.py output messages during the session with NO Corruption, Delay, or Losses
- PART A– UDP_Server.py output messages during the session with NO Corruption, Delay, or Losses
- PART B– UDP_Client.py output messages during the session with Corruption, Delay, and Losses
- PART B– UDP_Server.py output messages during the session with Corruption, Delay, and Losses
本网站支持 Alipay WeChatPay PayPal等支付方式
E-mail: firstname.lastname@example.org 微信号:vipnxx