The Transmission Control Protocol (TCP)

Slides:



Advertisements
Similar presentations
EE 4272Spring, 2003 Chapter 17 Transport Protocols Connection-Oriented Transport Protocol  Under Reliable Network Service  Design Issues  Under Unreliable.
Advertisements

TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
CSCI 4550/8556 Computer Networks
Transmission Control Protocol (TCP)
Transport Layer3-1 TCP. Transport Layer3-2 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection.
UDP & TCP Where would we be without them!. UDP User Datagram Protocol.
1 Transport Layer Lecture 9 Imran Ahmed University of Management & Technology.
1 TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
1 CS 4396 Computer Networks Lab Transmission Control Protocol (TCP) Part I.
TCP: Transmission Control Protocol Overview Connection set-up and termination Interactive Bulk transfer Timers Improvements.
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
Transport Layer – TCP (Part1) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
EECC694 - Shaaban #1 lec #12 Spring Internet Transport Protocols Transmission Control Protocol (TCP):Transmission Control Protocol (TCP):
TELE202 Lecture 14 TCP/UDP (2) 1 Lecturer Dr Z. Huang Overview ¥Last Lecture »TCP/UDP (1) »Source: chapter 17 ¥This Lecture »TCP/UDP (2) »Source: chapter.
1 TCP CSE May TCP Services Flow control Connection establishment and termination Congestion control 2.
- Reliable Stream Transport Service
Transport Layer 3-1 Transport Layer r To learn about transport layer protocols in the Internet: m TCP: connection-oriented protocol m Reliability protocol.
Department of Electronic Engineering City University of Hong Kong EE3900 Computer Networks Transport Protocols Slide 1 Transport Protocols.
1 K. Salah Module 6.1: TCP Flow and Congestion Control Connection establishment & Termination Flow Control Congestion Control QoS.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
WXES2106 Network Technology Semester /2005 Chapter 8 Intermediate TCP CCNA2: Module 10.
Gursharan Singh Tatla Transport Layer 16-May
1 Chapter Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)
1 Transport Layer Computer Networks. 2 Where are we?
The Transmission Control Protocol (TCP) TCP is a protocol that specifies: –How to distinguish among multiple destinations on a given machine –How to initiate.
3: Transport Layer3b-1 TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 r full duplex data: m bi-directional data flow in same connection m MSS: maximum.
TCOM 509 – Internet Protocols (TCP/IP) Lecture 04_b Transport Protocols - TCP Instructor: Dr. Li-Chuan Chen Date: 09/22/2003 Based in part upon slides.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
TCP Lecture 13 November 13, TCP Background Transmission Control Protocol (TCP) TCP provides much of the functionality that IP lacks: reliable service.
University of the Western Cape Chapter 12: The Transport Layer.
ECE453 – Introduction to Computer Networks Lecture 14 – Transport Layer (I)
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 2.5 Internetworking Chapter 25 (Transport Protocols, UDP and TCP, Protocol Port Numbers)
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
The Transmission Control Protocol (TCP) Application Services (Telnet, FTP, , WWW) Reliable Stream Transport (TCP) Connectionless Packet Delivery.
1 TCP: Reliable Transport Service. 2 Transmission Control Protocol (TCP) Major transport protocol used in Internet Heavily used Completely reliable transfer.
Chapter 24 Transport Control Protocol (TCP) Layer 4 protocol Responsible for reliable end-to-end transmission Provides illusion of reliable network to.
1 CS 4396 Computer Networks Lab TCP – Part II. 2 Flow Control Congestion Control Retransmission Timeout TCP:
ECE 4110 – Internetwork Programming
IP1 The Underlying Technologies. What is inside the Internet? Or What are the key underlying technologies that make it work so successfully? –Packet Switching.
Transmission Control Protocol (TCP) connection-oriented stream data transfer data sent as an unstructured stream of bytes reliability acknowledgements.
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
1 TCP ProtocolsLayer name DNSApplication TCP, UDPTransport IPInternet (Network ) WiFi, Ethernet Link (Physical)
1 Chapter 24 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)
TCP - Part II.
DMET 602: Networks and Media Lab
Fast Retransmit For sliding windows flow control we waited for a timer to expire before beginning retransmission of a packet TCP uses an additional mechanism.
TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581 full duplex data:
Introduction to Networks
Transmission Control Protocol (TCP)
5. End-to-end protocols (part 1)
Module 1 UDP & TCP.
TCP.
TCP.
PART 5 Transport Layer Computer Networks.
TCP.
Review: UDP demultiplexing TCP demultiplexing Multiplexing?
TCP - Part I Karim El Defrawy
Transport Layer Unit 5.
Chapter 5 TCP Transmission Control
Dr. John P. Abraham Professor UTPA
Chapter 17. Transport Protocols
PART V Transport Layer.
PART 5 Transport Layer.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Lecture 21 and 22 5/29/2019.
Transport Protocols: TCP Segments, Flow control and Connection Setup
Process-to-Process Delivery: UDP, TCP
Transport Layer 9/22/2019.
Presentation transcript:

The Transmission Control Protocol (TCP) Application Services (Telnet, FTP, e-mail, WWW) Reliable Stream Transport (TCP) Connectionless Packet Delivery Service (IP) Unreliable Transport Service (UDP)

The Transmission Control Protocol (TCP) TCP is a protocol that specifies: How to distinguish among multiple destinations on a given machine How to initiate and terminate a stream transfer Format of the data and acknowledgments that two computers exchange to achieve a reliable transfer Procedures the computers use to ensure that the data arrives correctly

ACKNOWLEDGMENT NUMBER TCP Segment Format TCP divides the data stream into segments for transmission: 0 4 10 16 24 31 ... CHECKSUM URGENT POINTER OPTIONS (IF ANY) PADDING DATA HLEN RESERVED CODE BITS WINDOW ACKNOWLEDGMENT NUMBER SOURCE PORT DESTINATION PORT SEQUENCE NUMBER

TCP Segment Header Fields Code bits - identify the contents of the segment: Window - how much data the sender is willing to accept (flow control) Urgent pointer - specifies the position in the segment where urgent data ends

Out of Band Data TCP provides a mechanism to handle urgent data Urgent data is received before octets already in the stream Sender: Sets urgent bit in segment header Puts urgent data at the beginning of the data field Sets urgent pointer to the end of the urgent data Receiver: Notified of the urgent data as soon as it arrives Enters “urgent mode” until all urgent data has been consumed Returns to “normal mode”

TCP Segment Header Fields (cont) Checksum - used to verify the integrity of the segment Computed over: Segment header Segment data Pseudo header 1’s complement addition algorithm Options - signal various options Maximum segment size

TCP - Acknowledgments and Retransmission Uses cumulative acknowledgment scheme: ACK 7 = “all octets up to but not including number 7 have been received correctly” Advantages ACKs are easy to generate and unambiguous Lost acknowledgments do not force retransmission Disadvantages Sender does not receive information about all successful transmissions

TCP - Timeout and Retransmission For each segment sent: Start timer and wait for acknowledgment Retransmit if timer expires TCP uses an adaptive retransmission algorithm because internet delays are so variable Round trip time of each connection is recomputed every time an acknowledgment arrives Timeout value is adjusted accordingly

TCP - Timeout and Retransmission (cont) How should the most recent round trip sample (RTS) effect the round trip time (RTT)? New RTT = (a * RTT) + ((1-a) * RTS) a = 0 a = 1 How should RTT be used to compute timeout? Timeout = b * RTT b = 1 b > 1

Accurate Measurement of Round Trip Samples Simple answer: Difference in time segment sent and time ACK received But what about retransmissions? Does ACK correspond to first or second copy of segment sent? Assuming ACK is for the earliest transmission causes problems Assuming ACK is for the latest transmission causes problems TCP acknowledgments are ambiguous

Accurate Measurement of Round Trip Samples To avoid problems with ambiguous ACKs: TCP should not update the RTT for retransmitted segments Problem: if timeout value is too small all segments will cause retransmissions and RTT will never be updated Timer back-off: if the timer expires and causes a retransmission TCP increases the timeout New timeout = c * timeout

Karn’s Algorithm “When computing the round trip estimate, ignore samples that correspond to retransmitted segments, but use a backoff strategy, and retain the timeout value from a retransmitted packet for subsequent packets until a valid sample is obtained.”

Responding to High Variance in Delay Often a good estimate of the round trip time is not very useful because internet delays tend to have a high variance Most TCP implementations estimate: Average round trip time Variance Using the variance Timeout = b * RTT

Responding to Congestion Endpoints cannot know the details of where in the internet congestion has occurred or why Congestion will usually lengthen delays TCP’s response to lengthened delays (retransmission) can cause congestion collapse Instead, TCP must reduce transmission rates when congestion occurs

Responding to Congestion (cont) Augment the TCP transmission window with a congestion window: Window=min(receiver advertisement,congestion window) Multiplicative Decrease Congestion Avoidance: Upon loss of a segment reduce the congestion window by half (down to a minimum of one segment) Backoff the retransmission timer exponentially

Responding to Congestion (cont) Slow-start (additive) recovery: When starting traffic on a new connection or increasing traffic after a period of congestion Start the congestion window at the size of a single segment and increase the congestion window by one segment each time an ACK arrives Congestion avoidance phase (during recovery): Once the congestion window reaches half of its original size before congestion occurred Increase the size of the congestion window by 1 only if all segments in the window have been acknowledged

TCP Timeout and Retransmission - Summary What do we get for all this stuff: Slow-start increase Multiplicitive decrease Congestion avoidance Measurement of RTT and variance Exponential timer backoff Dramatic improvement of TCP performance without adding significant computational overhead

Establishing a TCP Connection The 3-way handshake Guarantee that both sides are ready for connection Allows both sides to agree on initial sequence numbers Site 1 Network Site 2 Send SYN seq=x Send SYN seq=y, ACK x+1 Send ACK y+1 Receive SYN&ACK Receive ACK Receive SYN

Closing a TCP Connection Applications should close a connection when they have no more data to transmit Connection can be closed in either one or both directions Site 1 finishes transmitting data and waits for ACK from site 2 Site 1 transmits a segment with the FIN bit set Site 2 acknowledges the FIN segment Site 2 notifies the application that no more data is coming Data can still be transmitted from site 2 to site 1 Site 1 will still receive and acknowledge data from site 2 Eventually, site 2 will finish transmitting and close its connection Both endpoints delete record of the connection

Closing a TCP Connection (cont) Site 1 Network Site 2 (app closes connection) Send FIN seq=x Receive FIN Send ACK x+1 (inform application) Receive ACK (app closes connection) Send FIN seq=y, ACK x+1 Receive FIN&ACK Send ACK y+1 Receive ACK

TCP Connection Reset Applications normally close connections Sometimes abnormal conditions arise that break a connection Broken connections can be reset: Site 1 sends a segment with the RST bit set Site 2 receives segment and aborts the connection Transfers in both directions cease immediately Resources for the connection are released Applications programs are informed

Forcing Data Delivery TCP divides the stream of octets into segments for transmission This improves efficiency since octets can be buffered until a good-sized segment can be sent TCP provides a push operation for applications that want to force delivery of octets Set PSH bit Send segment

Reserved TCP Port Numbers Like UDP: Static port bindings for commonly used services Ports 0-1024 are reserved Dynamic port bindings Port numbers over 1024 Port numbers for services accessible by both UDP and TCP usually match ECHO (7) TIME (37)

Reserved TCP Port Numbers Port number: Service: 0 Reserved 7 Echo 17 Quote of the day 21 FTP 23 TELNET 25 SMTP 37 Time 79 Finger 80 HTTP 119 NNTP

TCP Performance Silly Window Syndrome Sender generates data quickly Receiver reads incoming data one octet at a time Sender Receiver

TCP Performance (cont) Silly Window Syndrome Each ACK advertises a small amount of space Each segment carries a small amount of data Problems: Poor use of network bandwidth Unnecessary computational overhead

TCP Performance (cont) Avoiding Silly Window Syndrome Use heuristics at sender to avoid transmitting a small amount of data in each segment Use heuristics at receiver to avoid sending small window advisements Receive-side silly window avoidance Monitor receive window size Delay advertising an increase until a “significant” increase is possible “Significant” = min(half the window, maximum segment size)

Receive-Side Silly Window Avoidance Example Receive 6 octets, send ACK 7 with window advisement of 0 Application reads one octet Application reads one octet Application reads one octet Send window advisement of 3, receive 3 octets

Receive-Side Silly Window Avoidance Two approaches: Receiver can ACK received octets but does not advertise an increase in its window until the increase is significant Receiver can not send ACKs when the window is not large enough to advertise Advantages/disadvantages?

Send-Side Silly Window Avoidance Goal: avoid sending small segments Application can generate data in small blocks TCP must collect data sent by application into a single large segment (clump) for transmission TCP must delay sending a segment until it contains a reasonable amount of data How long should TCP wait before transmitting data?

Send-Side Silly Window Avoidance (cont) The Nagle Algorithm: Application generates data to be sent over a connection that has already transmitted some data If all previous transmissions have been acknowledged send the data immediately If any ACKs are still pending do not transmit until: Maximum segment size is reached, or An ACK arrives Self-clocking - does not compute delays Applies even if the application requests a push

TCP Summary Provides reliable stream delivery service Full duplex Out-of-band for urgent data Makes efficient use of the network Piggybacking Sliding windows Efficiency End-to-end flow control Acknowledgment and retransmission Congestion recovery/avoidance