TCP Transport Control Protocol
Information management 2 Groep T Leuven – Information department 2/35 Introduction UDP provides the connection less, unreliable, datagram service TCP provides the connection oriented, reliable, byte stream service
Information management 3 Groep T Leuven – Information department 3/35 TCP Services Best sized chunks Adaptive timeout and retransmission strategy Acknowledgements Checksums Re-sequencing Discard duplicates Flow control
Information management 4 Groep T Leuven – Information department 4/35 TCP Header IP Header IP Header TCP Header TCP Header TCP data TCP segment IP datagram 20 bytes
Information management 5 Groep T Leuven – Information department 5/35 TCP Header 20 bytes 16-bit Source port number 32-bit sequence number 16-bit urgent pointer Options (if any) Data (if any) 16-bit Destination port number 32-bit acknowledgement number 16-bit window size 16-bit TCP checksum header length reserved URGURG PSHPSH RSTRST SYNSYN FINFIN ACKACK
Information management 6 Groep T Leuven – Information department 6/35 Connection establishment : 3-way handshake SYN 12345:12345 (0) Client Ack SYN 67890:67890 (0) ack Server Segment 2 Segment 1 Segment 3 SYN 12345:12345 (0) SYN seq# : (seq#+#bytes)(#bytes) option
Information management 7 Groep T Leuven – Information department 7/35 Best Sized Chunks Option MSS (maximum segment size) Announced on session establishment Interactive data --> byte per byte (Nagle algorithm) Bulk data uses MSS
Information management 8 Groep T Leuven – Information department 8/35 Connection Termination Client ack FIN 67890:67890 (0) ack Server Segment 2 Segment 4 Segment 3 FIN 12345:12345 (0) ack Ack Segment 4
Information management 9 Groep T Leuven – Information department 9/35 Reset a connection SYN 12345:12345 (0) win 4096 ClientServer Segment 2 Segment 1 RST 0:0 (0) ACK Win 0 No ICMP !!! Server is NOT Running Service on Port 2000
Information management 10 Groep T Leuven – Information department 10/35 Half open connections SYN 12345:12345 (0) Client ack SYN 67890:67890 (0) ack Server Segment 2 Segment 1 Segment 3 P 12346:12350 (4) ack P 67891:67899 (8) ack Segment 4 Segment 5 REBOOT ??????
Information management 11 Groep T Leuven – Information department 11/35 Adaptive timeout and retransmission strategy Exponential backoff –t, 2t, 4t, 8t, 16t, 32t, 64t seconds until 9 min TCP calculates rrt --> used for timeout value (t)
Information management 12 Groep T Leuven – Information department 12/35 Acknowledgements & Flow Control Overview Full duplex Piggy backing Controls for the receiver –Sliding window protocol Controls for the sender –slow start : congestion window –Congestion avoidance :slow start treshold
Information management 13 Groep T Leuven – Information department 13/35 Full duplex ClientServer Full duplex traffic possible because sequence number and acknowledge number efficient
Information management 14 Groep T Leuven – Information department 14/35 Sliding window protocol Client Fast Sender Server Slow Receiver Slow receiver controls the flow by resizing the Window ack 67891, win 0 PSH 67890, win 4096 PSH 55890, win 4096 PSH 44890, win 4096 ack 67891, win 4096 PSH 99890, win 4096 PSH 88890, win 4096 PSH 77890, win 4096 Slow receiver shifts the window (same seq nr) ack 99891, win 0 Slow receiver acknowledges (seq nr + 1)
Information management 15 Groep T Leuven – Information department 15/35 Slow Start - Window size – buffer size ack receiver sender ack 1 ack 2 & receiver sender ack 2 & 3 ack 2 time 0 time 8 time 1 time 2 time 3 time 4 time 5 time 6 time 7 time 10 time 12 time 13 time 15 time time 9 ss-window=1 ss-window=2
Information management 16 Groep T Leuven – Information department 16/35 Slow Start - Window size – buffer size (continued) ss-window=4 ss-window=8
Information management 17 Groep T Leuven – Information department 17/35 Increasing the congestion window will not improve the system anymore, in effect, it will get worse ! receiver sender time 32 time 33 time 34 ss-window=16 Slow Start - Window size – buffer size (continued)
Information management 18 Groep T Leuven – Information department 18/35 How big should the window be ? 8 segments outstanding And unacknowledged Capacity (bits) = bandwidth (bits/sec) x round-trip-time (sec) OR
Information management 19 Groep T Leuven – Information department 19/35 Capacity = bandwidh x delay double RTT RTT
Information management 20 Groep T Leuven – Information department 20/35 Congestion ACK Bottleneck Congestion R1R2 Fast LAN Slow WAN ss-window=16 congestion-window=16 - no ack - time out
Information management 21 Groep T Leuven – Information department 21/ Slow Start Exponential Growth Congestion Avoidance Phase Linear Growth Congestion Avoidance