![Page 1: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/1.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 1
Internetworking Technologies
Transmission Control Protocol (TCP)
![Page 2: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/2.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 2
IP review
IP provides just enough 'connectedness' Global addressing Hop-by-hop routing
IP over everything Ethernet, ATM, X.25, SONET, etc.
Lack of state in the network
Unreliable packet (datagram) switching
![Page 3: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/3.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 3
TCP key features
Sequencing
Byte-stream delivery
Connection-oriented
Reliability
![Page 4: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/4.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 4
TCP feature summary
Provides a completely reliable (no data duplication or loss), connection-oriented, full-duplex stream transport service that
allows two application programs to form a connection, send data in either direction
and then terminate the connection.
![Page 5: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/5.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 5
Apparent contradiction
IP offers best-effort (unreliable) delivery
TCP uses IP
TCP provides completely reliable transfer
How is this possible?
![Page 6: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/6.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 6
Achieving reliability
Reliable connection startup
Reliable data transfer Sender starts a timer Receiver sends ACK when data arrives Sender retransmits if timer expires before
ACK is returned Reliable connection shutdown
![Page 7: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/7.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 7
Reliability illustrated
![Page 8: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/8.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 8
How long to wait before retransmitting?
Time for ACK to return depends on: Distance between sender/receiver Network traffic conditions End system conditions
Packets can be lost, damaged or fragmented
Traffic conditions can change rapidly
![Page 9: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/9.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 9
Solving the retransmission problem
Keep running average of round trip time (RTT) for each TCP connection
Current average (estimate) determines retransmission timer
How does each RTT affect the average?
This is known as adaptive retransmission
Key to TCP's success
![Page 10: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/10.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 10
Adaptive retranmission illustrated
![Page 11: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/11.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 11
Flow control
Match sending rate to receiver rate
TCP uses a sliding window Receiver advertises available buffer space Also known as the window Sender can transmit a full window size before
receiving an ACK
![Page 12: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/12.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 12
Window advertisement
Each ACK carries the current window size Called the window advertisement Can be zero (a closed window)
Interpretation of window advertisement: Receiver: I can accept X octets or less unless I
tell you otherwise
![Page 13: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/13.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 13
Window advertisement illustrated
![Page 14: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/14.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 14
Another view: the sliding window
![Page 15: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/15.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 15
Byte stream sequencing
Each segment contains a sequence number
Sequencing helps ensure in-order delivery
TCP sequence numbers are fixed at 32 bits
Is the byte stream of limited size (232 bytes)?
Initial sequence numbers (ISN) are exchanged at connection startup
ACKs acknowledgement cumulative bytes
![Page 16: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/16.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 16
TCP segment format
![Page 17: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/17.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 17
Application multiplexing
Separation of functionality from IP In the beginning TCP and IP were one No unused bits to encode application process
Cannot use OS dependent quality Process ID Task number Job name
Semantics must work on all end systems
![Page 18: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/18.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 18
Port numbers
Separation of functionality from IP In the beginning TCP and IP were one No unused bits to encode application process
Cannot use OS dependent quality Process ID Task number Job name
Semantics must work on all end systems
![Page 19: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/19.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 19
TCP ports
Each application assigned a unique integer
Server Follows a standard (e.g. Well know ports) Uses a well known port number Usually uses lower port numbers
Client Obtains unused port from protocol software Usually uses high numbered ports
![Page 20: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/20.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 20
TCP connection startup
Uses a three message exchange
AKA 3-way handshake
Necessary and sufficient for unambiguous and reliable startup
Sequence number exchange is primary goal
Can also exchange other parameters e.g. maximum segment size
![Page 21: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/21.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 21
3-way handshake illustrated
![Page 22: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/22.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 22
TCP connection shutdown
![Page 23: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/23.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 23
Congestion
Flow control
Congestion control
Avoidance
![Page 24: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/24.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 24
Useful terms before proceding
Maximum segment size (MSS)
Window
Retransmission
Timer
Delayed ACK
Duplicate ACK
![Page 25: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/25.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 25
Congestion window
Sender based flow control Rather than by a window advertisement
Sender uses min(cwnd, advertised window) This is the transmission window
Infer network conditions and adjust
Use timers, ACKs and network feedback
![Page 26: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/26.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 26
TCP segment retransmission
TCP starts timer after sending a segment
If ACK returns, reset timer
If not, retransmit and set (timer = timer x 2) This is backoff
Can't retransmit forever, error may occur
Timer is the estimate of round trip time (RTT) Current, running average of RTT
![Page 27: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/27.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 27
Round trip time (RTT)
TCP measures RTT
TCP uses estimated RTT to calculate timers
If ACKs return quickly, timers are short If loss occurs, recovery is quicker
The converse is also true
RTT too high = throughput suffers
RTT too low = unnecessary retransmits
![Page 28: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/28.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 28
TCP slow start
Initialize cwnd to 1 MSS
Increase cwnd by 1 MSS for every ACK
Not really that slow
![Page 29: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/29.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 29
TCP congestion avoidance
When timer expires (loss?), slow down! Set ssthresh = (transmission window x ½) Set cwnd = 1 Transmit min(cwnd, transmission window) Slow start until transmission window = sshtresh Thereafter, increase cwnd by 1/cwnd per ACK
![Page 30: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/30.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 30
Congestion avoidance illustrated
![Page 31: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/31.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 31
TCP fast retransmit
If 3 or more duplicate ACKs are received before timer has expired
Sender assumes loss Assumes out of order packets had enough time
to be reassembled
Retransmit without waiting for timer to expire
Enter TCP fast recovery
![Page 32: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/32.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 32
TCP fast recovery
Sender assumes data is still flowing Due to the reception of duplicate ACKs
Loss was probably a temporary event
Go into congestion avoidance, not slow start Just cut cwnd in half Resume additive increase (1/cwnd) per ACK
![Page 33: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/33.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 33
Other mechanisms
Selective acknowledgements (SACK)
Traffic shaping
ACK pacing
AQM (FIFO and RED and variants)
ECN, ICMP source quench, back pressure
Fair queueing
Class/uality of service (CoS/QoS)
![Page 34: TDC365 Spring 2001John Kristoff - DePaul University1 Internetworking Technologies Transmission Control Protocol (TCP)](https://reader035.vdocuments.site/reader035/viewer/2022062714/56649d395503460f94a13438/html5/thumbnails/34.jpg)
TDC365 Spring 2001 John Kristoff - DePaul University 34
Congestion collapse
When network load increases and less actual work gets done due to packet drops
Fragmented packets are especially bad
As retransmissions increase, goodput drops