490 likes | 612 Views
Destination. Reassembly Required. router. IP packet fragments. Fragments Created. router. IP packet. source. TCP. Connection Oriented state Stream Oriented Sequence number Full Duplex Reliable acknowledgment. TCP Commands. Syn – synchronize sequence numbers Ack – acknowledgement
E N D
Destination Reassembly Required router IP packet fragments Fragments Created router IP packet source
TCP • Connection Oriented • state • Stream Oriented • Sequence number • Full Duplex • Reliable • acknowledgment
TCP Commands • Syn – synchronize sequence numbers • Ack – acknowledgement • Fin – close connection • Push – send data immediately • Urgent – look at data out of sequence • Reset – reject connection
TCP Connection • Passive Open • Server opens known port and waits for client to connect (no traffic on network) • Active open • Client opens any available port and connects to server on known port (starts three way handshake)
CLOSED LISTEN ESTABLISHED SYN-SENT CLOSE-WAIT SYN-RCVD FIN-WAIT-1 LAST-ACK FIN-WAIT-2 TIME-WAIT Active open/syn Passive open Syn/ syn+ack Syn+ack/ack ack Fin/ack Close/fin Ack/ Close/fin Fin/ack timeout ack
TCP Sliding Window • Sequence No. - number of first byte in the segment • Acknowledgement – number of next byte expected • Sliding Window – number of bytes that can be transmitted without an acknowledgement
Sender Sliding Window Receiver Sliding Window
Sent, not yet acked Ready to send Sliding Window
Sent, not yet acked Sent and ACKed Sliding Window Ready to send
Sent and ACKed Sliding Window
Server Client Syn Seq 7280 Client sends syn to open connection
Server Client Syn Seq 5965 Ack 7281 Syn, Ack Server sends Ack and Syn
Server Client Syn Syn, Ack Ack Cient sends Ack, connection is established Seq 7281 Ack 5966
Server Client Syn Syn, Ack Ack Client requests Web Page Ack, Push Seq 7281 Ack 5966
Server Client Syn Syn, Ack Ack Ack Server sends first part of Web Page Ack Seq 5966 ack 7532
Ack Ack Ack Server Client Syn Syn, Ack Ack Ack Server sends remainder of page Seq 5966 ack 7531 Seq 7426 ack 7531
Ack Ack Ack Server Client Syn Syn, Ack Ack Ack Ack Client sends ack Seq 7531 ack 8886
Ack Ack Ack Server Client Syn Syn, Ack Ack Ack Server starts closing of connection Ack Ack, Fin, Push Seq 8886 ack 7531
Ack Ack Ack Server Client Syn Syn, Ack Ack Ack Ack Ack, Fin, Push Ack Client acks closing of server’s side of connection Seq 7531 ack 9203
Ack Ack Ack Server Client Syn Syn, Ack Ack Ack Ack Ack, Fin, Push Seq 7531 ack 9203 Ack Ack, Fin Client requests closing of its side of connection
Ack Ack Ack Ack Server Client Syn Syn, Ack Ack Ack Ack Ack, Fin, Push Seq 9203 ack 7532 Ack Ack, Fin Server sends Ack, connection closed
16 0 8 31 TYPE CODE CHECKSUM IDENTIFIER SEQUENCE NUMBER OPTIONAL DATA ICMP Echo message
ftp client ftp server 131.123.8.111 131.123.250.211 2353 2349 21 20 TCP Segments Proto Local Address Foreign Address TCP 131.123.8.111:2349 131.123.250.211:21 TCP 131.123.8.111:2353 131.123.250.211:20