CS 716 Advanced Computer Networks By Dr Amir
CS 716 Advanced Computer Networks By Dr. Amir Qayyum
Lecture No. 30 2
TCP Outline • • 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 3
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) 4
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 5
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 6
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 ? 7
End-to-End Argument • A function should not be provided at a given layer unless it can be completely and correctly implemented at that layer • In-order delivery: hop-by-hop ordering guarantee is not robust to path changes or multiple paths F A B C E D 8
End-to-End Argument • Congestion control – Should be stopped at source – But network can provide feedback A 100 Mbps 5 Mbps 100 Mbps B 1 Mbps 100 Mbps 10 Mbps C D 5 Mbps E 10 Mbps F blue should get 9 Mbps, but gets only 5 Mbps with hop-by-hop drops 9
TCP Model of Use • Connection setup via 3 -way 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 4 -step exchange 10
TCP Connection Setup • TCP Connection Setup via 3 -way 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 closes connection FIN K Client ACK K+1 Server 13
TCP Segment Header & Pseudo-Header 0 16 4 10 source port destination port sequence number ACK sequence number 0 hdrlen flags advertised window TCP checksum urgent pointer options (variable) 0 8 0 16 source IP address destination IP address 6 (TCP) TCP length 31 31 14
TCP Segment Header • 16 -bit source and destination ports • 32 -bit send and ACK sequence numbers • 4 -bit header length in 4 -byte words (minimum 5) 15
TCP Segment Header • Six 1 -bit 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
- Slides: 16