Download presentation
Presentation is loading. Please wait.
1
TCP
2
Internet Protocol (IP): Recap
Addressing Routing Fragmentation and Reassembly Quality of Service Multiplexing and Demultiplexing
3
Transmission Control Protocol (TCP)
End-to-end transport protocol Responsible for reliability, congestion control, flow control, and sequenced delivery Applications that use TCP: http (web), telnet, ftp (file transfer), smtp ( ), chat Applications that don’t: multimedia (typically) – use UDP instead
4
TCP Connection Establishment Connection Maintenance
Reliability Congestion control Flow control Sequencing Connection Termination
5
Ports, End-points, & Connections
IP Layer TCP UDP http ftp smtptelnet A1 A2 A3 Transport Port IP address Protocol ID Thus, an end-point is represented by (IP address,Port) Ports can be re-used between transport protocols A connection is (SRC IP address, SRC port, DST IP address, DST port) Same end-point can be used in multiple connections
6
Active and Passive Open
How do applications initiate a connection? One end (server) registers with the TCP layer instructing it to “accept” connections at a certain port The other end (client) initiates a “connect” request which is “accept”-ed by the server
7
Connection Establishment & Termination
3-way handshake used for connection establishment Randomly chosen sequence number is conveyed to the other end Similar FIN, FIN+ACK exchange used for connection termination Server does passive open Accept connection request Send acceptance Start connection Active open Send connection request SYN SYN+ACK ACK DATA
8
Sequencing Byte sequence numbers
TCP receiver buffers out of order segments and reassembles them later Starting sequence number randomly chosen during connection establishment Why? 3 1 2 4 1 given to app 2 given to app Loss 4 buffered (not given to app) 3 & 4 given to app 4 discarded
9
Fundamental Mechanism
ack data data retx Simple stop and go protocol Timeout based reliability (loss recovery) ack data Multiple unacknowledged packets (W) Ideal W=2*B*D Sliding Window Protocol: ….
10
Reliability (Loss Recovery)
ack data Sequence Numbers TCP uses cumulative Acknowledgments (ACKs) Next expected in-sequence packet sequence number Pros and cons? Piggybacking 5 1 2 3 4 3 1 2 4 Timeout calculation Rttavg = k*Rttavg + (1-k)*Rttsample RTO = Rttavg + 4*Rttdeviation
11
Congestion Control Slow Start Start with W=1 For every ACK, W=W+1
Congestion Avoidance (linear increase) For every ACK, W = W+1/W Congestion Control (multiplicative decrease) ssthresh = W/2 W = 1 Alternative: Fall to W/2 and start congestion avoidance directly
12
Why LIMD? (fairness) W=1 W=W/2 100 10 diff = 90 1 1 diff = 0
Problem? – inefficient W=W/2 diff = 45 51 6 diff = 45 52 7 diff = 45 .. diff = 45 diff = 23.5 diff = 23.5 diff = 11.2
13
Flow Control Prevent sender from overwhelming the receiver
Receiver in every ACK advertises the available buffer space at its end Window calculation MIN(congestion control window, flow control window)
14
TCP Segment Format 16 bit SRC Port 16 bit DST Port
32 bit sequence number 32 bit ACK number HL resvd flags 16 bit window size Flags: URG, ACK, PSH, RST, SYN, FIN 16 bit TCP checksum 16 bit urgent pointer Options (if any) Data
15
TCP Flavors TCP-Tahoe TCP-Reno TCP-NewReno TCP-SACK Others
16
TCP Tahoe Slow-start Congestion control upon time-out
In addition, fast retransmit enabled When the sender receives 3 duplicate ACKs for the same sequence number, sender infers a loss On congestion, ssthresh set to half of current congestion window (W), congestion window reduced to 1 and slow-start performed again Simple Congestion control too aggressive
17
TCP Reno Tahoe + Fast recovery
Packet loss detected both through timeouts, and through DUP-ACKs Sender reduces window by half, the ssthresh is set to half of current window During fast recovery, window expanded even for DUP-ACKs Fast recovery ensures that pipe does not become empty Window cut-down to 1 (and subsequent slow-start) performed only on time-out
18
TCP New-Reno TCP-Reno with more intelligence during fast recovery
In TCP-Reno, the first partial ACK will bring the sender out of the fast recovery phase Mostly results in timeouts when there are multiple losses In TCP New-Reno, partial ACK is taken as an indication of another lost packet (which is immediately retransmitted). Sender comes out of fast recovery only after all outstanding packets (at the time of first loss) are ACKed
19
TCP SACK TCP (Tahoe, Reno, and New-Reno) uses cumulative acknowledgements When there are multiple losses, TCP Reno and New-Reno can retransmit only one lost packet per round-trip time What about TCP-Tahoe? SACK enables receiver to give more information to sender about received packets allowing sender to recover from multiple-packet losses faster
20
TCP SACK (Example) Assume packets 5-25 are transmitted
Let packets 5, 12, and 18 be lost Receiver sends back a CACK=5, and SACK=(6-11,13-17,19-25) Sender knows that packets 5, 12, and 18 are lost and retransmits them immediately
21
Other TCP flavors TCP Vegas TCP FACK
Uses round-trip time as an early-congestion-feedback mechanism Reduces losses TCP FACK Intelligently uses TCP SACK information to optimize the fast recovery mechanism further
22
User Datagram Protocol (UDP)
Simpler cousin of TCP No reliability, sequencing, congestion control, flow control, or connection management! Serves solely as a labeling mechanism for demultiplexing at the receiver end Use predominantly by protocols that do no require the strict service guarantees offered by TCP (e.g. real-time multimedia protocols) Additional intelligence built at the application layer if needed
23
UDP Header Src Port Dst Port Length: length of header + data (min = 8)
Checksum
24
Puzzle Two great mathematicians S & P
S knows the sum of two positive integers (> 1) x and y P knows the product of x and y S calls P and says “You cannot find the two numbers” P replies “I know the two numbers” S responds “I know the two numbers too” What are the two numbers?!!
25
Recap TCP Connection management Reliability Flow control
Congestion control TCP flavors UDP
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.