Project 2 Reliable Transport

Similar documents
Project 3 - Routers, Protocols and Firewalls

Basic Reliable Transport Protocols

EE122 Fall 2013 Project 1 - Routing Protocols Due: October 10, 2013, 11:59:59 PM

CSE434 Computer Networks (FALL, 2009) Programming Assignment 3 Due: Wed, December 2, 2009

file:///c:/users/hpguo/dropbox/website/teaching/fall 2017/CS4470/H...

CS457 Transport Protocols. CS 457 Fall 2014

Problem 7. Problem 8. Problem 9

CSE 123: Computer Networks Alex C. Snoeren. HW 1 due NOW!

Lab 1 - Reliable Data Transport Protocol

Lab 2: Implementing a Reliable Transport Protocol (30 points)

UNIT IV -- TRANSPORT LAYER

The Transport Layer Reliability

ECE5650: Computer Networking and Programming Term Project Assignment Part II: Total 100 points

NWEN 243. Networked Applications. Layer 4 TCP and UDP

Review problems (for no credit): Transport and Network Layer

Preview Test: HW3. Test Information Description Due:Nov. 3

Networked Systems and Services, Fall 2018 Chapter 3

CS 640 Introduction to Computer Networks Spring 2009

Stream Control Transmission Protocol

Networked Systems and Services, Fall 2017 Reliability with TCP

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2. Goals for Todayʼs Lecture. Role of Transport Layer

CS 5520/ECE 5590NA: Network Architecture I Spring Lecture 13: UDP and TCP

User Datagram Protocol (UDP):

COMPUTER NETWORK. Homework #2. Due Date: April 12, 2017 in class

PLEASE READ CAREFULLY BEFORE YOU START

PLEASE READ CAREFULLY BEFORE YOU START

Programming Assignment 3: Transmission Control Protocol

Lecture 3: The Transport Layer: UDP and TCP

CS 43: Computer Networks. 16: Reliable Data Transfer October 8, 2018

ECE697AA Lecture 3. Today s lecture

Network Protocols. Sarah Diesburg Operating Systems CS 3430

The GBN sender must respond to three types of events:

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

14-740: Fundamentals of Computer and Telecommunication Networks

No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

Announcements. No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

Programming Assignment 5: Implementing a Reliable Transport Protocol

User Datagram Protocol

TCP/IP-2. Transmission control protocol:

Unit 2.

Outline. CS5984 Mobile Computing

Announcements. IP Forwarding & Transport Protocols. Goals of Today s Lecture. Are 32-bit Addresses Enough? Summary of IP Addressing.

Mobile Transport Layer Lesson 10 Timeout Freezing, Selective Retransmission, Transaction Oriented TCP and Explicit Notification Methods

Outline Computer Networking. Functionality Split. Transport Protocols

An SCTP-Protocol Data Unit with several chunks

Announcements Computer Networking. Outline. Transport Protocols. Transport introduction. Error recovery & flow control. Mid-semester grades

CMSC 417 Project Implementation of ATM Network Layer and Reliable ATM Adaptation Layer

Lecture 7: Flow Control"

The Transmission Control Protocol (TCP)

Lecture 4: CRC & Reliable Transmission. Lecture 4 Overview. Checksum review. CRC toward a better EDC. Reliable Transmission

Transport Protocols & TCP TCP

6.033 Lecture 12 3/16/09. Last time: network layer -- how to deliver a packet across a network of multiple links

CS 421: COMPUTER NETWORKS SPRING FINAL May 16, minutes

CCNA 1 Chapter 7 v5.0 Exam Answers 2013

Programming: Reliable Transport - Alternating Bit

Computer Networking. Reliable Transport. Reliable Transport. Principles of reliable data transfer. Reliable data transfer. Elements of Procedure

Operating Systems and Networks Project 1: Reliable Transport

The Transport Layer: TCP & Reliable Data Transfer

Internet and Intranet Protocols and Applications

TCP/IP. Chapter 5: Transport Layer TCP/IP Protocols

TCP : Fundamentals of Computer Networks Bill Nace

EE 122: IP Forwarding and Transport Protocols

CSC 4900 Computer Networks: TCP

Request for Comments: 938 February 1985

Problem Set 7 Due: Start of Class, November 2

Flow Control, and Congestion Control

Communication Networks

Guide To TCP/IP, Second Edition UDP Header Source Port Number (16 bits) IP HEADER Protocol Field = 17 Destination Port Number (16 bit) 15 16

TCP/IP Protocol Suite 1

Transport Layer (TCP/UDP)

Overview. Exercise 0: Implementing a Client. Setup and Preparation

Different Layers Lecture 20

Announcements Computer Networking. What was hard. Midterm. Lecture 16 Transport Protocols. Avg: 62 Med: 67 STD: 13.

COMP/ELEC 429/556 Project 2: Reliable File Transfer Protocol

CSCI-131 Networking: the End-to-End Layer. Rodrigo Fonseca March 12 th, 2013

Internet Layers. Physical Layer. Application. Application. Transport. Transport. Network. Network. Network. Network. Link. Link. Link.

CIS 505: Software Systems

Computer Science 461 Midterm Exam March 14, :00-10:50am

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

Computer Networks. Project 2. Project Assigned: November 14 Checkpoint: November 21 12:01 AM Due: December 04 12:01 AM. Networks - Project 2 1

Lecture 5: Flow Control. CSE 123: Computer Networks Alex C. Snoeren

Transport Protocols. Raj Jain. Washington University in St. Louis

UDP: Datagram Transport Service

ECE 333: Introduction to Communication Networks Fall 2001

Total Points 100 (One Hundred)

CS 640 Introduction to Computer Networks. Role of data link layer. Today s lecture. Lecture16

Internet transport-layer protocols. Transport services and protocols. Sending and receiving. Connection-oriented (TCP) Connection-oriented

Project 1. 1 Introduction. October 4, Spec version: 0.1 Due Date: Friday, November 1st, General Instructions

The Transport Layer Multiplexing, Error Detection, & UDP

TCP: Flow and Error Control

Basic Protocols and Error Control Mechanisms

CS321: Computer Networks Error and Flow Control in TCP

Reliable Transport : Fundamentals of Computer Networks Bill Nace

CS3516 Computer Networks. Program 3 {October 27, 2014} 55 points

Chapter 23 Process-to-Process Delivery: UDP, TCP, and SCTP 23.1

CSCI-1680 Link Layer I Rodrigo Fonseca

Chapter 3 Review Questions

Note: This practice midterm only covers a subset of the topics you are required to know.

c. If the sum contains a zero, the receiver knows there has been an error.

Computer Communications and Networks (COMN), 2017/18, Semester 1

Transcription:

Project 2 Reliable Transport UC Berkeley CS 168, Fall 2014 Version 1.0 Due: 11:59am (noon), November 2nd, 2014 In this project, you will build a simple reliable transport protocol, BEARS TP (BTP). Your protocol must provide in order, reliable delivery of UDP datagrams, and must do so in the presence of packet loss, delay, corruption, duplication, and re ordering. There are a variety of ways to ensure a message is reliably delivered from a sender to a receiver. We will provide you with a reference implementation of a receiver (which you must use) that returns a cumulative ACK whenever it receives a data packet. This is further explained with an example later. Your job is to implement a sender that, when sending packets to this receiver, achieves reliable delivery. Protocol Description Our simple protocol has four message types: start, end, data, and ack. start, end, and datamessages all follow the same general format. start <sequence number> <data> <checksum> data <sequence number> <data> <checksum> end <sequence number> <data> <checksum> To initiate a connection, send a startmessage. The receiver will use the sequence number provided as the initial sequence number for all packets in that connection. After sending the startmessage, send additional packets in the same connection using the data message type, adjusting the sequence number appropriately. Unsurprisingly, the last data in a connection should be transmitted with the endmessage type to signal the receiver that the connection is complete. Your sender should accept acknowledgements from the receiver in the format: ack <sequence number> <checksum> An important limitation is the maximum size of your packets. The UDP protocol has an 8 byte header, and the IP protocol underneath it has a header of ~20 bytes. Because we will be using Ethernet networks, which have a maximum frame size of 1500 bytes, this leaves 1472 bytes for your entire packet (message type, sequence number, data, and checksum). However, small packet size hurts performance. Therefore, in order to meet the performance requirement, packet payload size should be larger than 1000 bytes (unless it is the last packet in the stream), but less than 1472 bytes. The angle brackets ( < and > ) are not part of the protocol. However, you should ensure that

there are no extra spaces between your delimiters ( character) and the fields of your packet. For specific formatting details, see the sample code provided. Receiver specification We will provide a simple receiver for you; the reference implementation we provide will also be 1 used for grading, so make sure that your sender is compatible with it. The BEARS TP receiver responds to data packets with cumulative acknowledgements. Upon receiving a message of type start, data, or end, the receiver generates an ackmessage with the sequence number it expects to receive next, which is the lowest sequence number not yet received. In other words, if it expects a packet of sequence number N, the following two scenarios may occur 1. If it receives a packet with sequence number not equal to N, it will send ack N. 2. If it receives a packet with sequence number N, it will check for the highest sequence number (say M) of the in order packets it has already received and send ack M+1. For example, if it has already received packets N+1 and N+2 (i.e. M = N+2), but no others past N+2, then it will send ack N+3. Let s illustrate this with an example. Suppose packets 0, 1, and 2 are sent, but packet 1 is lost before reaching the receiver. The receiver will send ack 1 upon receiving packet 0, and then ack 1 again upon receiving packet 2. As soon as the receiver receives packet 1 (due to retransmission from the sender), it will send ack 3 (as it already has received, and upon receiving this acknowledgement the sender can assume all three packets were successfully received. If the next expected packet is N, the receiver will drop all packets with sequence number greater than N+4; that is, the receiver operates with a window of five packets, and drops all packets that fall outside of that range. When the next unexpected packet is N+1 (due to N arriving), then the receiver will accept packet N+5. You can assume that once a packet has been acknowledged by the receiver, it has been properly received. The receiver has a default timeout of 10 seconds; it will automatically close any connections for which it does not receive packets for that duration. Sender specification The sender should read an input file and transmit it to a specified receiver using UDP sockets. It should split the input file into appropriately sized chunks of data, specify an initial sequence number for the connection, and append a checksum to each packet. The sequence number should increment by one for each additional packet in a connection. Functions for generating and validating packet checksums will be provided for you (see Checksum.py). 1 We will test your senders in a variety of scenarios: e.g., packet loss or data corruption. Just because your sender is compatible with the receiver in one test environment does not ensure a perfect score! Your sender must be capable of handling all scenarios outlined in this document.

Your sender must implement a reliable transport algorithm (Go Back N). Remember that the receiver s window size is five packets, and it any packets it receives outside this window will be ignored. Your sender must be able to accept ackpackets from the receiver. Any ackpackets with an invalid checksum should be ignored. Your sender should provide reliable service under the following network conditions: Loss: arbitrary levels; you should be able to handle periods of 100% packet loss. Corruption: arbitrary types and frequency. Re ordering: may arrive in any order, and Duplication: you could see a packet any number of times. Delay: packets may be delayed indefinitely (but in practice, generally not more than 10s). Your sender should be invoked with the following command: python Sender.py f <input file> Some final notes about the sender: The sender should implement a 500ms retransmission timer to automatically retransmit packets that were never acknowledged (potentially due to ackpackets being lost). We do not expect you to use an adaptive timeout. Your sender should support a window size of 5 packets (i.e., 5 unacknowledged packets). Your sender should roughly meet or exceed the performance (in both time and number of packets required to complete a transfer) of a properly implemented Go Back N based BEARS TP sender. Your sender should be able to handle arbitrary message data (i.e., it should be able to send an image file just as easily as a text file). Any packets received with an invalid checksum should be ignored. Your implementation must run on hive[##].cs.berkeley.edu. However, it should work on any system that runs the appropriate version of Python (we tested on version 2.7.1 under Ubuntu 11.04 and 2.6.5 under SunOS 5.10). Your sender should be written in Python and adhere to the standards given in PEP 8, Style Guidelines for Python Code. Your sender MUST NOT produce console output during normal execution; Python exception messages are ok, but try to avoid having your program crash in the first place. We will evaluate your sender on correctness, time of completion for a transfer, and number of packets sent (and re sent). Transfer completion time and number of packets used in a transfer will be measured against our own reference implementation of a Go Back N based sender. Note that a Stop And Wait sender [described below] will not have adequate performance. Performance Improvements

Correctly implementing a simple Go Back N transport protocol will give you 85% of the total score. You can add the following performance enhancements, for the remaining 15% credits. Fast Retransmit (5%): Go Back N sender retransmits the unacknowledged packet only on a timeout event, which can wait up to 500ms. Instead, we can detect the packet loss event by duplicated ack event. If we receive three duplicated acknowledgements (that is, receiving the same acknowledgement number for 4 times), we are almost sure the packet has been lost and we should immediately retransmit the packet. For example, if the sender sends five packets with sequence numbers 0,1,2,3,4, but packet 1 is lost. On receiving packet 0,2,3,4, the receiver will send cummulaitve acknowledgement ack 1 four times back to the sender. Upon receiving the fourth ack 1, the sender should retransmit packet 1. Selective Acknowledgements (10%): If the sender knows exactly what packets the receiver has received, it can retransmit only the missing packets (rather than naively retransmitting the last N packets). We have modified the receiver to provide explicit acknowledgement of which packets have been received. To earn these 10 points, you should implement SACK, or Selective Acknowledgement, functionalities at the sender. The Receiver.py runs in SACK mode if you enable the k or sack option. In SACK mode, in addition to sending a cummulative acknowledgement, the receiver also sends selective acknowledgements in the following format. sack <cum_ack;sack1,sack2,sack3,...> <checksum> cum_ack is the cummulative acknowledge, which is the same as the one in an ack packet. Following the cum_ack is a semicolon and a list of sack s separated by comma. For example, if the sender sends five packets with sequence numbers 0,1,2,3,4, but packet 1 and 2 are lost. The following table shows the sack packets sent by the receiver when a packet is received. Packet Received sack packet sent by the receiver 0 sack 1; <checksum> 3 sack 1;3 <checksum> 4 sack 1;3,4 <checksum> On getting a timeout (or three duplicated acknowledgements, if you have implemented fast retransmit), the sender should therefore retransmit only packets with sequence numbers 1 and 2.

The sender should be running in SACK mode when the k or sack option is on. We test your sender by running: Receiver side: python Receiver.py k Sender side: python Sender.py f <filename> k In SACK mode, your sender should only retransmit packets that are missing. For instance, in the previous example that packet 1 is missing, the sender should only retransmit packet 1 after the timeout. Testing You are responsible for testing your own project. In order to make this process easier for you, we ve included a test harness that you can use to develop tests for your project. See the README in the code for the project for more details, as well as TestHarness.py and the example test cases in the tests directory. Note that passing the example test cases is a necessary but not sufficient condition for a good score on this project! These are only meant as tests of basic functionality and examples for your own test cases; you must think about the types of edge cases your sender could encounter, as well as the various conditions required for correctness. Hints and Tips To begin with, just focus on the simple case where nothing bad ever happens to your packets. After you have that case working, you can consider how to handle packet loss. It may help to build your way up to a full fledged reliable sender. The simplest reliable transport mechanism is Stop And Wait, in which the sender transmits a single packet and waits for the receiver to acknowledge its receipt before transmitting more. You could start by building a Stop And Wait sender, and extending that for the full Go Back N based sender. Understand that Stop And Wait sender is only a stepping stone, and we require you to submit a full BEARS TP sender for evaluation. README You must also supply a README file along with your solution. This should contain: You (and your partner s) names and login How challenging was this project on a scale of 1 (easiest) to 10 (hardest)? How long did it take you? Code Check the lecture schedule page for the latest copy of the project code. Submission Instructions On the instructional machines, create a tar file with both your and your partner s last names (e.g. project2 obama biden or project2 shenker). The tar file should contain your entire project folder, includes at least contain the following two files (case sensitive)::

Sender.py README... Your implementation should be in Sender.py because the autograder only copy this file to the grading directory. So if you want to define any new class, try put it in Sender.py. Lastly, make sure your tar file passes the format check script, which should be run in the base bears tp directory with all other supporting files. If you are working in group, please only submit one copy. That is, either you or your project partner should submit, but not both. $ tar cf project2 obama biden.tar Sender.py README $./format check.sh project2 obama biden.tar The expected output is: Found Sender.py Found README Now running 'BasicTest'... Test passes! Now running 'RandomDropTest'... Test passes! If this is what you get, then run submit project2. Collaboration Policy The project is designed to be solved independently, but you may work in partners if you wish. Grading will remain the same whether you choose to work alone or in partners; both partners will receive the same grade regardless of the distribution of work between the two partners (so choose a partner wisely!). You may not share code with any classmates other than your partner. You may discuss the assignment requirements or your solutions (e.g., what data structures were used to store routing tables) away from a computer and without sharing code but you should not discuss the detailed nature of your solution (e.g., what algorithm was used to compute the routing table). Assignments suspected of cheating or forgery will be handled according to the Student Code of 2 Conduct. Apparently 23% of academic misconduct cases at a certain junior university are in 3 Computer Science, but we expect you all to uphold high academic integrity and pride in doing your own work. 2 http://sa.berkeley.edu/code of conduct 3 http://www.pcworld.com/article/194486/why_computer_science_students_cheat.html