Advanced Computer Networks: Lecture 30. This lecture will cover the following: TCP vs a sliding window on a direct link; model of use; segment header format and options; states and state diagram (think-pair-share); sliding window implementation details; flow control issues; bit allocation limitations; adaptive retransmission algorithms;...
CS716 Advanced Computer Networks By Dr. Amir Qayyum 1 Lecture No. 30 TCP Outline • • • • • • • • TCP vs a sliding window on a direct link Model of use Segment header format and options States and state diagram (thinkpairshare) Sliding window implementation details Flow control issues Bit allocation limitations Adaptive retransmission algorithms TCP vs Sliding Window on Direct Link • RTT varies – Among peers (hosts at other end of connections) – Over time – Requires adaptive approach to retransmission (and window sizes) TCP vs Sliding Window on Direct Link • Packets can be – Delayed for long periods (assume 60 seconds) – Reordered in the network – Must be prepared for arrival of very old packets TCP vs Sliding Window on Direct Link • Peer capabilities vary – Minimum link speed on route – Buffering capacity at destination – Requires adaptive approach to window sizes TCP vs Sliding Window on Direct Link • Network capacity varies – Other traffic competes for most links – Requires (global) congestion control strategy • Why not implement more functionality in IP, e.g. ordering guarantees or congestion control ? EndtoEnd Argument • A function should not be provided at a given layer unless it can be completely and correctly implemented at that layer • Inorder delivery: hopbyhop ordering guarantee is not robust to path changes or multiple paths F A B C E D EndtoEnd Argument • Congestion control – Should be stopped at source – But network can provide feedback A 100Mbps 5Mbps 100Mbps 100Mbps B 1Mbps 100Mbps 1Mbps 10Mbps C D 5Mbps E 10Mbps F 10Mbps blue should get 9Mbps, but gets only 5Mbps with hopbyhop drops TCP Model of Use • Connection setup via 3way handshake • Data transport – Sender writes some data – TCP • Breaks data into segments • Sends each segment over IP • Retransmits, reorders, and removes duplicates as necessary – Receiver reads some data • Teardown through 4step exchange 10 TCP Connection Setup • TCP Connection Setup via 3way Handshake – J and K are (different) sequence numbers for messages – Sequence numbers need not start at zero SYN J Active participant (client) SYN K ACK J+1 Passive participant (server) ACK K+1 11 TCP Data Transport Model • Data broken into segments – – – – Limited by maximum segment size (MSS) Defaults to 536 bytes Negotiable during connection setup Typically set to MTU of directly connected network minus size of IP and TCP headers (40 bytes) • Three events send segment – >= MSS bytes of data ready to be sent – Explicit PUSH operation by application – Periodic timeout 12 TCP Connection Teardown • TCP connection teardown in 4 steps – Either client or server can initiate connection teardown – FIN is associated with sequence number space active close FIN J ACK J+1 passive close closes connection FIN K Client ACK K+1 Server 13 TCP Segment Header & PseudoHeader 16 10 source port destination port sequence number ACK sequence number hdrlen flags advertised window TCP checksum urgent pointer options (variable) 16 source IP address destination IP address 6 (TCP) TCP length 14 31 31 TCP Segment Header • 16bit source and destination ports • 32bit send and ACK sequence numbers • 4bit header length in 4byte words (minimum 5) 15 TCP Segment Header • Six 1bit flags – URG: segment contains urgent data – ACK: ACK sequence number is valid – PSH: do not delay delivery of data – RST: reset connection (rejection or abnormal termination); no sequence number associated – SYN: synchronize segment for setup – FIN: final segment for teardown 16 .. .Lecture? ?No.? ?30 TCP Outline • • • • • • • • TCP vs a sliding window on a direct link Model of use Segment header format and options