1 / 21

TCP

TCP. Transport Control Protocol. Introduction. UDP provides the connection less, unreliable, datagram service TCP provides the connection oriented, reliable, byte stream service. TCP Services. Best sized chunks Adaptive timeout and retransmission strategy Acknowledgements Checksums

trey
Download Presentation

TCP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TCP Transport Control Protocol

  2. Introduction • UDP provides the connection less, unreliable, datagram service • TCP provides the connection oriented, reliable, byte stream service

  3. TCP Services • Best sized chunks • Adaptive timeout and retransmission strategy • Acknowledgements • Checksums • Re-sequencing • Discard duplicates • Flow control

  4. IP Header TCP Header TCP data TCP Header IP datagram TCP segment 20 bytes 20 bytes

  5. 0 15 16 31 16-bit Source port number 16-bit Destination port number 32-bit sequence number 20 bytes 32-bit acknowledgement number U R G A C K P S H R S T S Y N F I N header length reserved 16-bit window size 16-bit TCP checksum 16-bit urgent pointer Options (if any) Data (if any) TCP Header

  6. Connection establishment : 3-way handshake Client Server SYN 12345:12345 (0) <mss 1024> Segment 1 SYN 67890:67890 (0) ack 12346 <mss 1024> Segment 2 Segment 3 Ack 67891 SYN 12345:12345 (0) <mss 1024> SYN seq# : (seq#+#bytes) (#bytes) option

  7. Best Sized Chunks • Option MSS (maximum segment size) • Announced on session establishment • Interactive data --> byte per byte (Nagle algorithm) • Bulk data uses MSS

  8. Connection Termination Client Server FIN 67890:67890 (0) ack 12345 <mss 1024> Segment 4 Segment 2 ack 67891 Segment 3 FIN 12345:12345 (0) ack 67891 <mss 1024> Segment 4 Ack 12346

  9. Reset a connection Client Server <src port 1087 > <dst port 2000> SYN 12345:12345 (0) win 4096 <mss 1024> Server is NOT Running Service on Port 2000 Segment 1 <src port 2000 > <dst port 1087> RST0:0 (0) ACK 12346 Win 0 Segment 2 No ICMP !!!

  10. Half open connections Client Server SYN 12345:12345 (0) <mss 1024> Segment 1 SYN 67890:67890 (0) ack 12346 <mss 1024> Segment 2 ack 67891 Segment 3 P 12346:12350 (4) ack 67891 Segment 4 P 67891:67899 (8) ack 12351 Segment 5 REBOOT ??????

  11. Adaptive timeout and retransmission strategy • Exponential backoff • t, 2t, 4t, 8t, 16t, 32t, 64t seconds until 9 min • TCP calculates rrt --> used for timeout value (t)

  12. Acknowledgements & Flow Control Overview • Full duplex • Piggy backing • Controls for the receiver • Sliding window protocol • Controls for the sender • slow start : congestion window • Congestion avoidance :slow start treshold

  13. Full duplex Client Server Full duplex traffic possible because sequence number and acknowledge number  efficient

  14. Sliding window protocol Client Fast Sender Server Slow Receiver ack 67891, win 4096 PSH44890, win 4096 PSH55890, win 4096 PSH 67890, win 4096 Slow receiver controls the flow by resizing the Window ack 67891, win 0 ack 67891, win 4096 Slow receiver shifts the window (same seq nr) PSH77890, win 4096 PSH88890, win 4096 PSH99890, win 4096 Slow receiver acknowledges (seq nr + 1) ack 99891, win 0

  15. time 0 sender 1 sender 2 time 8 time 1 1 3 2 time 9 1 time 2 3 2 time 10 time 3 1 receiver 3 2 receiver ack 1 time 4 3 time 12 receiver ack 2 receiver time 13 ack 1 time 5 ack 2 & 3 time 14 ack 1 time 6 ack 2 & 3 time 7 ack 1 ack 2 & 3 time 15 sender sender Slow Start - Window size – buffer size ss-window=1 ss-window=2

  16. time 16 sender 4 sender 8 time 24 ack 3 ack 5&6&7 time 17 time 25 5 4 9 8 6 5 4 time 18 10 9 8 time 26 7 6 5 4 receiver 11 10 9 8 receiver time 28 7 6 5 time 20 12 11 10 9 ack 4 receiver ack 8 receiver time 29 7 6 13 12 11 time 21 10 ack 4&5 time 30 ack 4&5&6 7 time 22 14 13 12 11 time 23 ack 4&5&6&7 ack 8-11 15 14 13 12 time 31 sender sender Slow Start - Window size – buffer size (continued) ss-window=4 ss-window=8

  17. sender . . . receiver 18 16 19 17 18 17 15 16 15 14 16 17 16 14 13 15 Slow Start - Window size – buffer size (continued) time 32 • Increasing the congestion window will not improve the system anymore, in effect, it will get worse ! ss-window=16 time 33 time 34

  18. Capacity (bits) = bandwidth (bits/sec) x round-trip-time (sec) How big should the window be ? 8 segments outstanding And unacknowledged OR

  19. 1 2 3 4 1 2 3 4 5 6 7 8 1 2 3 4 1 2 Capacity = bandwidh x delay RTT double RTT RTT 3 4

  20. 4 3 4 3 4 3 2 1 Congestion congestion-window=16 - no ack - time out ss-window=16 Bottleneck  Congestion Fast LAN Fast LAN Slow WAN 2 1 2 1 R1 R2 ACK

  21. Congestion Avoidance 45 40 Congestion Avoidance Phase Linear Growth 35 30 25 20 15 10 Slow Start Exponential Growth 5 0 0 10 20 30 40 50

More Related