150 likes | 413 Views
TCP Transmission Control Protocol. How does TCP provide reliable service over an unreliable network?. Introduction. What is TCP? What is TCP for? The Transport Layer What is required for reliable communications over unreliable media? TCP connections The TCP header Flow Control
E N D
TCPTransmission Control Protocol How does TCP provide reliable service over an unreliable network?
Introduction • What is TCP? • What is TCP for? • The Transport Layer • What is required for reliable communications over unreliable media? • TCP connections • The TCP header • Flow Control • The “Three Way Handshake” • TCP traffic • The “Graceful close” • Summary
What is TCP? • Transmission Control Protocol • RFC 973 • TCP/IP protocol suite • Connection oriented • Reliable
What is TCP for? “The Transmission Control Protocol (TCP) is intended for use as a highly reliable host-to-host protocol between hosts in packet-switched computer communication networks, and in interconnected systems of such networks.” RFC 793
The Transport Layer OSI ISO TCP/IP Application Application Presentation Session Transport TCP Transport Network Internet Data Link Network Access Physical
Reliable Communications over Unreliable Media • Basic Data Transfer • Reliability • Flow Control • Multiplexing • Connections • Precedence and Security
The TCP Header Source Port Destination Port Sequence Number Acknowledgement Number Data Offset Reserved U R G A C K P S H R S T S Y N F I N Window Checksum Urgent Pointer Options Padding Data
TCP Communications Telnet Telnet TCP Module TCP Module LOGICAL CONNECTION FTP FTP
Three way handshake Active open client (Client) Passive open client (Server) LISTEN SYN_SENT ISN = 46 (SEQ = 46)(CTL = SYN) SYN_RECEIVED ISN = 82 AN = 46 + 1 = 47 (SEQ = 82)(ACK = 47)(CTL = SYN, ACK) ESTABLISHED (SEQ = 47)(ACK = 83)(CTL = ACK) ESTABLISHED A B
TCP traffic Segmented byte stream Seg 1 Seg 2 Seg 3 Seg 4 Seg 5 Seg 6 Seg 7 0 1000 1400 2000 2400 2800 3200 4000
Seg 1 1 Seg 1 Seg 3 2 Seg 1 Seg 3 Seg 4 3 Seg 1 Seg 2 Seg 3 Seg 4 4 1400 2000 2400 Flow control Received segments Acknowledgements ACK = 1000 WIN = 1600 ACK = 1000 WIN = 1600 ACK = 1000 WIN = 1600 ACK = 2400 WIN = 1600 0 1000
2MSL CLOSED Graceful close Active close (Client) Passive close (Server) Application close() (SEQ = 58)(ACK = 94)(CTL = FIN, ACK) CLOSE_WAIT FIN_WAIT_1 EOF to application (SEQ = 94)(ACK = 59)(CTL = ACK) LAST_ACK (SEQ = 94)(ACK = 59)(CTL = FIN, ACK) FIN_WAIT_2 (SEQ = 59)(ACK = 95)(CTL = ACK) TIME_WAIT CLOSED A B
How does TCP provide reliable service over an unreliable network? Connection oriented Recovers from data that is: Damaged Lost Duplicated Out of order Prevents loss of data Reliable Summary