The Transmission Control Protocol (TCP) Application Services (Telnet, FTP, e-mail, WWW) Reliable Stream Transport (TCP) Unreliable Transport Service (UDP) Connectionless Packet Delivery Service (IP)
Goals for Today s Lecture Principles underlying transport-layer services (De)multiplexing Detecting corruption Reliable delivery Flow control Transport-layer protocols in the Internet User Datagram Protocol (UDP) Transmission Control Protocol (TCP) 2
3 E.g., IP Role of Transport Layer Application layer Communication for specific applications E.g., HyperText Transfer Protocol (HTTP), File Transfer Protocol (FTP), Network News Transfer Protocol (NNTP) Transport layer Communication between processes (e.g., socket) Relies on network layer and serves the application layer E.g., TCP and UDP Network layer Logical communication between nodes Hides details of the link technology
Transport Protocols Provide logical communication between application processes running on different hosts Run on end hosts Sender: breaks application messages into segments, and passes to network layer Receiver: reassembles segments into messages, passes to application layer Multiple transport protocol available to applications application transport network data link physical network data link physical network data link physical network data link physical network data link physical network data link physical 4 application transport network data link physical
Internet Transport Protocols Datagram messaging service (UDP) No-frills extension of best-effort IP Reliable, in-order delivery (TCP) Connection set-up Discarding of corrupted packets Retransmission of lost packets Flow control Congestion control (next lecture) Other services not available Delay guarantees Bandwidth guarantees 5
TCP Support for Reliable Delivery Checksum Used to detect corrupted data at the receiver leading the receiver to drop the packet Sequence numbers Used to detect missing data... and for putting the data back in order Retransmission Sender retransmits lost or corrupted data Timeout based on estimates of round-trip time Fast retransmit algorithm for rapid retransmission 6
Initiating Stream Transfers (cont) An endpoint for a TCP connection is defined by a (host, port) pair Host = the IP address of for a host Port = a TCP port on that host A TCP connection is defined by a pair of endpoints: Port 1037 on www.whitehouse.gov and port 76 on viper.cs.virginia.edu: (198.137.240.91, 1037) and (128.143.137.17, 76)
TCP Data Stream Format Data from application programs is a sequence of octets (with no type associated) TCP divides data into segments for transmission Usually, each segment travels across the internet in a single IP datagram
Providing Reliability with Acknowledgments and Retransmissions Sender Network Receiver Send packet 1 Receive packet 1 Send ACK 1 Receive ACK 1 Send packet 2 Receive packet 2 Send ACK 2 Receive ACK 2
Packet Loss Sender Network Receiver Send packet 1 (Timeout) Send packet 1 Receive packet 1 Send ACK 1 Receive ACK 1
ACK Loss Sender Network Receiver Send packet 1 Receive packet 1 Send ACK 1 (Timeout) Send packet 1 Receive packet 1 (Discard) Send ACK 1 Receive ACK 1
ACK Delayed Sender Network Receiver Send packet 1 Receive packet 1 Send ACK 1 (Timeout) Send packet 1 Receive ACK 1 Receive packet 1 (Discard) Send ACK 1 Receive ACK 1 (Discard)
A Problem A simple positive acknowledgment protocol wastes a substantial amount of network bandwidth because it must delay sending a new packet until it receives an acknowledgment for the previous packet.
A Solution Sender Network Receiver 2 1 3 ACK1 ACK2 ACK3
Sliding Windows window 1 2 3 4 5 6 7 8 9 10 All packets inside the window can be transmitted When an acknowledgment for packet 1 is received the window slides to the right and allows the transmission of packet 9: 1 2 3 4 5 6 7 8 9 10
Sliding Windows (cont) Receiver must keep a sliding window as well: window 1 2 3 4 5 6 7 8 9 10 After packet 1 is received and acknowledged: 1 2 3 4 5 6 7 8 9 10
Sliding Windows (cont) 1 2 3 4 5 6 7 8 9 10 Conceptually partitions the packets into three classes: Transmitted, received, and acknowledged packets (outside and left of sliding window) Packets being transmitted (inside the window) Packets waiting to be transmitted (outside and right of sliding window)
Ideal Sliding Window Performance Sender Network Receiver