COMP 3331/9331 Assignment T2 2021 All details are in the specification • READ THE SPECIFICATION • READ THE SPECIFICATION (AGAIN) • Information about deadlines, file names, submission instructions, marking guidelines, example interactions and various other specifics are in the specification • Choice of programming languages: C, Java, Python • This talk provides a high-level overview Padawan Transport Protocol Goal: Implement a stripped-down version of TCP for reliable uni-directional transfer of data from Sender to Receiver Must use UDP PTP - Inclusions • 3-way connection setup (SYN, SYN+ACK, ACK) • 4-way connection termination (FIN, ACK, FIN, ACK) • Possible to combine the ACK and FIN from the Receiver in one message (effectively making it a 3-way process) • Sender must maintain a single timer and transmit the oldest unacknowledged segment • Receiver should buffer out of order segments • Fast retransmit (i.e., retransmission on reception of triple duplicate ACKs) • Include sequence and ack numbers like TCP • Use MWS (command-line argument) as window size • Use MSS (command-line argument) as the size of the data payload in PTP segment • MWS >= MSS and exactly divisible by MSS PTP - Exclusions • No need to randomize initial sequence number • No need to implement timeout estimation (timeout value provided as command line argument) • No need to double timeout interval • No need to implement delayed ACKs • No need to implement any flow control or congestion control • No need to deal with corrupted packets • No need to deal with abnormal behaviour (e.g., RST) PTP Segment Format • You will need to decide on the format of the PTP headers. You can draw inspiration from TCP. • PTP Segments will be encapsulated within UDP segments. No need to include port #’s in the PTP header. You will have to fill the port numbers in the UDP headers. • Same format for data and ACK segments • ACK segment contains no data UDP header PTP header PTP Payload UDP segment PTP segment PL Module • Purpose: simulate packet loss • Implemented at the Sender • You can assume that packets will never be delayed or corrupted • Exclude PTP segments for connection establishment or teardown • Exclude acknowledgments • PTP data segments are dropped with a probability pdrop • Code fragments provided for pseudo-random generation • You are required to use a fixed seed, provided as command line argument Execution • Receiver • Command line arguments: • receiver_port (use a value greater than 1023 and less than 65536) • FileReceived.txt (to be created by your program into which received data is written) • Executed first – waits for Sender to connect • Sender • Command line arguments: • receiver_host_ip (use “127.0.0.1” as Sender and Receiver will be executed on same machine) • Receiver_port (should match the first argument for the Receiver) • FileToSend.txt (text file to be sent to receiver, file exists in current working directory) • MWS: maximum window size in bytes • MSS: maximum segment size in bytes • Timeout: value of timeout in milliseconds • Pdrop: packet drop probability, between 0 and 1 • Seed: random number generation seed (an integer) • Let the OS pick an unused port • Sender should send UDP segments to Receiver (“127.0.0.1”, receiver_port) • You may assume that the correct number of command line arguments in the expected format will be always provided Execution Receiver Design 1. Connection setup 2. Data Transmission (repeat until end of file) a) Receive PTP segment b) Send ACK segment c) Buffer data or write data into file 3. Connection teardown Sender Design 1. Connection setup 2. Data Transmission (repeat until end of file) a. Read file b. Create PTP segment c. Start Timer if required (retransmit oldest unacknowledged segment on expiry) d. Send PTP segment to PL module e. If PTP segment is not dropped, transmit to Receiver f. Process ACK if received 3. Connection teardown Note: Sender needs to deal with multiple events, so you wish to explore the use of – (i) multiple threads (ii) non-blocking or asynchronous IO using polling, i.e., select() Logs – Very Important • Sender_log.txt •