Programming Assignment 2: Reliable Data Transfer Pirate Translation

Assigned Wednesday October 5th

Due Friday October 21st @11:59 PM

GitHub Repo

You will use the same GitHub repo from PA1. All of your files for this assignment should go inside a /PA2 folder

Overview

In this assignment, you will develop a reliable data transfer protocol between a client a server that communicate with sockets. The client program will ask for a sentence/phrase to be translated into pirate. Your program will divide up the original message into segments to send to the server. The server will receive these segments, reassemble them into the correct message, and translate them into pirate. The server segments this message and send them back to the original client where it will be reassembled into their translated sentence.
For example, "That boy is my friend" will be translated to "That lad is me hearty".

RDT Protocol

You will implement the Reliable Data Transfer 2.1 protocol. In this protocol, it is possible for messages and acknowledgements (ACKs) to arrive corrupted. If either one of those are corrupted, the sender or receiver needs to ask for a retransmission. This is a stop-and-wait protocol, so the sender must wait to send the next message until it has received an ACK for the previous message. RDT 2.1 also uses checksums to detect bit errors or corrupted packets, and uses sequence numbers to identify different segments. NAKs will never be corrupted.

Segmentation

One important responsibility of the transport layer is segmentation . When sending a message from point A to point B, the transport layer will divide up the application layer message into small segments, which will each receive a header before being sent into the network layer. The size of these segments are based on the Maximum Segment Size (MSS). This value will be an input parameter to your program.

Instructions

For this assignment, you will develop two programs: client.py and server.py .

client.py

The "client" will send a sentence that they would like to be translated to the server. This program is run via the command line and takes 3 command line parameters:
        
             python client.py [PORT_NUMBER] [MAXIMUM_SEGMENT_SIZE] [PACKET_CORRUPT_PROBABILITY] 
            example:  python client.py 5001 4 .2   //port 5001, segments will be length of 4, 20% corruption probability
        
The PORT_NUMBER argument is the port that the socket will bind to. Remember that you should only use ports greater than 1024. The [MAXIMUM_SEGMENT_SIZE] will represent how big the segments will be. For example, if MTT=4, each segment will have 4 characters as its data. [PACKET_CORRUPT_PROBABILITY] is the probability that a packet will be corrupted upon its arrival. This can be expressed as a percent (20), or a decimal (.2). For example, if this value is .2, then the client will send a corrupted packet to the server ~20% of the time. The client will segment the original sentence and send the segments one by one, but the client must wait for an ACK from the server before it can send the next segment. It is possible that the ACK could be corrupted, so when ACKs/message arrive, the client will need to check the checksum and ask for a retransmission from the server if needed. NAKs CAN NOT be corrupted, which will make things easier.

server.py

This file will be your server. The server is run from the command line with the same three inputs
             python server.py [PORT_NUMBER] [MAXIMUM_SEGMENT_SIZE] [PACKET_CORRUPT_PROBABILITY] 
            example:  python server.py 5001 8 .1   //port 5001, segments will be length of 8, 10% corruption probability
        
When the translates the message, it will segment the pirate message based on its MSS value and send the segments back to the client.[PACKET_CORRUPT_PROBABILITY] is the probability that a packet will be corrupted upon its arrival. This can be expressed as a percent (10), or a decimal (.1). For example, if this value is .1, then the server will send a corrupted packet to the client ~10% of the time.


Packet Class

You must define a packet class / struct in your program. You must be sending these objects through your socket between client and server. You can create a separate class for an ACK/NAK packet if you would like. Your class must have at least

   Class Packet {}

Example packet

Packet(4,"valid",2,4,"my f") would be an uncorrupted packet with the message "my f" and has a sequence number 4.
Packet(0,"valid",1,0,"") would be an uncorrupted acknowledgement (ACK) message

Pirate Language Translation file

I will provide you a basic csv file that includes some translations from english words to pirate words. Your server will need to read this file in order to translate the client's message. Pirate CSV file: https://www.cs.montana.edu/pearsall/classes/fall2022/466/programs/pirate.csv

Programming Language

You are allowed to use a programming language of your choice. Although, you must use a language that supports: Python is the support language for this class, so Reese will not be able to help with technical issues or syntax issues if you select a language other than Python. Java, Rust, Go, C/C++ are all valid languages to use.

Hints

Video Demo

You will record a video demo that highlights the functionality of your program. You can do this with Panopto, or you can record with another recording software (such as OBS) and post it to youtube as private or unlisted. Your video demo must also provide us a brief walkthrough of your code. This means your video demo will require commentary. Especially if you are using a language other than Python/Java, it will help Reese/Justin see that you followed the instructions.

Partners

You are allowed to work with 1 (one) partner. If you work with a partner, you should only create one private repository.

Submission Info

NEW: BOTH MEMBERS MUST SUBMIT A REPO LINK TO D2L. All files should be pushed to your repository. You still need a README that contains the video link and information about your program.

Grading Rubric (100 Points)

Requirement Points
Your program has a server and client program that are ran from the command line with correct parameters (port, MSS, corrupt %) 5
Your program segments messages based on the MSS 10
Segments are sent one-by-one, and do not send until an ACK from the previous message has been receieved 15
Segments are properly retransmitted when packet corruption occurs 15
All packets include AT LEAST (1) sequence number (2) checksum, (3) ack_or_nak_filed, (4) length, and (5) message 5
Packets arrive in same order as they were sent 5
The original message is reassembled and translated into pirate 15
The pirate sentence is segmented and sent back to client properly 15
Packets are sent through sockets 5
Your code is submitted to a private Github repo that has a README desribed how to run your program(s) and contains a link to your video demo 10


Penalties

Helpful Examples

















Solution