python-network-TCP-UDP代写: CS 3357a Assignment #3

Assignment #3 CS 3357a Fall 2016

Due Nov 11th, 2016 11:55pm

Background

We have seen how to send data over a TCP connection and now we want to explore data transfer using UDP. As you recall from the lectures, UDP is a non-reliable protocol so we are going to need to create a reliable transfer protocol in the application layer.

Summary

We will once again have two applications (UDP_Client.py and UDP_Server.py) but this time we will be using the UDP protocol, not TCP to communicate across the network. This means we have to create the reliable data transfer protocol (rdt) we saw in our textbook, specifically, we will create rdt2.2 for this assignment.

Just to refresh your memory, below are the FSMs for both the client and server we need to create:

We will be using the following format for our Pseudo UDP packet:

ACK SEQ DATA CHKSUM

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 rdt2.2 as shown in the textbook, so please make sure you follow it carefully!

Procedure

You must create two files, UDP_Client.py and UDP_Server.py. The details of each are shown below.

UDP_Client –

This app must connect to the UDP_Server app via UDP (you can use the local loopback address of 127.0.0.1 along with any port number you wish) then send three separate packets containing the following information:

NCC-1701
NCC-1664
NCC-1017

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 rdt2.2 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 rdt2.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 rdt2.2 process for creating a reliable transfer over UDP.  

Other Information

The output from the UDP_Server and UDP_Client should display a line of text for each of the following events:

  • Received Packet (with all packet values shown)
  • Packet Checksum Compare Result (ie. Corrupt or not corrupt)
  • Sent Packet (with all packet values shown)

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 following:

  • 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. (The files are tested for Python v3)

What to Submit

You will be submitting the following via OWL :

  • Files UDP_Server.py and UDP_Client.py 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. py output messages during the session
  2. py output messages during the session

Grading

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)