Survey
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project
ELEN 602 Lecture 15 • More on IP • TCP 1 TCP Streams Application Application byte stream byte stream segments Transmitter Receiver Send buffer Receive buffer ACKs 2 TCP end-to-end Flow control Transmitter Send Window Receiver Receive Window Slast+Wa-1 ... Octets transmitted Slast and ACKed ... Srecent Rlast Rlast+WR+1 ... Rnext Rnew Slast+Ws-1 Slast oldest unacknowledged octet Srecent highest-numbered transmitted octet Slast+Wa-1 highest-numbered octet that can be transmitted Slast+Ws-1 highest-numbered octet that can be accepted from the application Rlast highest-numbered octet not yet read by the application Rnext next expected octet Rnew highest numbered octet received correctly Rlast+WR-1 highest-numbered octet that can be accommodated in receive buffer 3 TCP Segment 0 4 10 16 Source Port 24 31 Destination Port Sequence Number Acknowledgement Number Header Length Reserved UAP R S F R C S S Y I GKH T NN Checksum Window Size Urgent Pointer Options Padding Data 4 TCP Pseudoheader 0 8 16 31 Source IP Address Destination IP Address 00000000 Protocol = 6 TCP Segment Length 5 3-way Handshake for connection establishment Host A Host B 6 Sequence numbers Host A Host B Delayed segment with Seq_no = n+2 will be accepted 7 TCP application example Host A (Client) socket connect (blocks) Host B (Server) socket bind listen accept (blocks) connect returns write read (blocks) accept returns read (blocks) read returns write read (blocks) read returns 8 TCP Window control Host A Host B t0 t1 t2 t3 t4 9 TCP Header overhead Data 20 bytes of TCP header 20 bytes of IP header TCP Header IP Header 10 Connection Termination Host A Host B Deliver 150 bytes 11 TCP State diagram CLOSED passive open, create TCB applic. close LISTEN SYN_RCVD applic. close, send FIN receive SYN, send ACK SYN_SENT applic. close or timeout, delete TCB ESTABLISHED CLOSE_WAIT FIN_WAIT_1 CLOSING LAST_ACK FIN_WAIT_2 TIME_WAIT 2MSL timeout delete TCB 12 Routing for mobile hosts Foreign network Home network Foreign agent Mobile host 2 Home agent Internet 3 1 Correspondent host 13 IP to IP Encapsulation Outer IP Header IP Header IP Header IP Payload IP Payload 14