1 / 31

TCOM 509 – Internet Protocols (TCP/IP) Lecture 04_b Transport Protocols - TCP

TCOM 509 – Internet Protocols (TCP/IP) Lecture 04_b Transport Protocols - TCP. Instructor: Dr. Li-Chuan Chen Date: 09/22/2003. Based in part upon slides of Prof. J. Kurose (U Mass), Prof. K. Fall (UC-Bekeley). Telnet. FTP. DNS. Application. TCP. UDP. IP. Transport. Packet radio.

Download Presentation

TCOM 509 – Internet Protocols (TCP/IP) Lecture 04_b Transport Protocols - 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. TCOM 509 – Internet Protocols (TCP/IP)Lecture 04_bTransport Protocols - TCP Instructor: Dr. Li-Chuan ChenDate: 09/22/2003 Based in part upon slides of Prof. J. Kurose (U Mass), Prof. K. Fall (UC-Bekeley)

  2. Telnet FTP DNS Application TCP UDP IP Transport Packet radio LAN Internet Net interface/ Physical Internet Layer Transport Layer: • UDP • TCP

  3. TCP • Provides the following reliable services to applications such as FTP, SMTP, TELNET. • Logical connection Establishment • Maintenance termination • Reliable data transfer • In-order byte stream • point-to-point: • one sender, one receiver • connection-oriented: • Establish a connection before data exchange • flow control • sender will not overwhelm receiver

  4. TCP - Reliability • Sequence numbers are used for re-ordering at the destination • Use sequence numbers and acknowledgements (ack) • sender sends a packet, starts a timer, and waits for ack before next send • Retransmit if data is lost (timer expires before receiving ack)

  5. TCP – Flow Control • Use sliding window mechanism • TCP sliding window operates at octet (byte) level not segment or packet level. • Receiver sends a window that specifies receiver current buffer size • Multiple segments can be sent before an ACK is received by the sender

  6. 32 bits source port # dest port # sequence number acknowledgement number head len not used Receive window U A P R S F checksum Urg data pnter Options (variable length) application data (variable length) TCP segment structure URG: urgent data (generally not used) counting by bytes of data (not segments!) ACK: ACK # valid PSH: push data now (generally not used) # bytes Receiver willing to accept RST, SYN, FIN: connection estab (setup, teardown commands) Internet checksum (as in UDP) TCP minimum header size = 20 bytes

  7. Opening a connection Three way handshake: Step 1: client host sends TCP SYN segment to server specifies initial seq # no data Step 2: server host receives SYN, replies with SYNACK segment server allocates buffers specifies server initial seq. # Step 3: client receives SYNACK, replies with ACK segment, which may contain data TCP Connection Management Host A Host B SYN, Seq=100 SYNACK, Seq=1000, Ack=101 ACK, Seq=101, Ack=1001 time TCP Connection scenario

  8. Closing a connection: Step 1:client end system sends TCP FIN control segment to server Step 2:server receives FIN, replies with ACK. Closes connection, sends FIN. TCP Connection Management (cont.) client server close FIN ACK close FIN ACK timed wait closed

  9. Step 3:client receives FIN, replies with ACK. Enters “timed wait” - will respond with ACK to received FINs Step 4:server, receives ACK. Connection closed. TCP Connection Management (cont.) client server closing FIN ACK closing FIN ACK timed wait closed closed

  10. Stop and Wait -Diagram

  11. stop-and-wait operation sender receiver first packet bit transmitted, t = 0 last packet bit transmitted, t = L / R first packet bit arrives RTT last packet bit arrives, send ACK ACK arrives, send next packet, t = RTT + L / R

  12. TCP: Transmission scenarios Host A Host B Seq, Seq=101, Ack=10018 bytes data ACK=109 timeout Seq=109, 16 bytes data ACK=125 time

  13. Pipelining: sender allows multiple packets send before receiving acknowledged range of sequence numbers must be increased buffering at sender and/or receiver Two generic forms of pipelined protocols: go-Back-N, selective repeat Pipelined protocols

  14. Go Back N - Diagram

  15. Pipelining: increased utilization sender receiver first packet bit transmitted, t = 0 last bit transmitted, t = L / R first packet bit arrives RTT last packet bit arrives, send ACK last bit of 2nd packet arrives, send ACK last bit of 3rd packet arrives, send ACK ACK arrives, send next packet, t = RTT + L / R Increase utilization by a factor of 3!

  16. Example Sliding Window

  17. receiver individually acknowledges all correctly received packets buffers packets, as needed, for eventual in-order delivery to upper layer sender only resends packets for which ACK not received sender timer for each unACKed pkt sender window N consecutive seq #’s again limits seq #s of sent, unACKed pkts Selective Repeat

  18. Selective repeat: sender, receiver windows

  19. Selective repeat in action

  20. Example: seq #’s: 0, 1, 2, 3 window size=3 receiver sees no difference in two scenarios! incorrectly passes duplicate data as new in (a) Q: what relationship between seq # size and window size? Selective repeat:dilemma

  21. Host A Host B Seq=101, 8 bytes data ACK=109 Seq=92 timeout timeout X loss Seq=101, 8 bytes data ACK=109 SendBase = 109 time time lost ACK scenario TCP: retransmission scenarios Host A Host B Seq=101, 8 bytes data Seq=109, 16 bytes data ACK=109 ACK=125 Seq=101, 8 bytes data Sendbase = 101 SendBase = 125 ACK=125 Seq=92 timeout SendBase = 125 premature timeout

  22. Host A Host B Seq=101, 8 bytes data ACK=109 Seq=109, 16 bytes data timeout X loss ACK=125 time Cumulative ACK scenario TCP retransmission scenarios (more) Cumulative ACK: • Pros: • acks are unambiguous and easy to generate. • Lost acks may not need to retransmit • Cons: • Sender does not receive all acks for the successful transmission SendBase = 125

  23. receive side of TCP connection has a receive buffer: speed-matching service: matching the send rate to the receiving app’s drain rate flow control sender won’t overflow receiver’s buffer by transmitting too much, too fast TCP Flow Control • app process may be slow at reading from buffer

  24. Congestion: informally: “too many sources sending too much data too fast for network to handle” different from flow control! manifestations: lost packets (buffer overflow at routers) long delays (queueing in router buffers) Principles of Congestion Control

  25. end-end control (no network assistance) sender limits transmission: LastByteSent-LastByteAcked  CongWin Roughly, CongWin is dynamic, function of perceived network congestion How does sender perceive congestion? loss event = timeout or 3 duplicate acks TCP sender reduces rate (CongWin) after loss event three mechanisms: AIMD slow start conservative after timeout events CongWin rate = Bytes/sec RTT TCP Congestion Control

  26. multiplicative decrease: cut CongWin in half after loss event additive increase: increase CongWin by 1 maximum segment size (MSS) every RTT in the absence of loss events: probing TCP AIMD

  27. Slow-start: Let i = ith iteration of round trip c = congestion window size Init i = 0, c=1: TCP sends 1 segment i = 1, c = 2: TCP sends 2 segments i = 2, c = 4: TCP sends 4 segments i = 3, c = 8: TCP sends 8 segments … i = n, what is the number of segments that TCP can send? Response to TCP Congestion

  28. When connection begins, increase rate exponentially until first loss event: double CongWin every RTT done by incrementing CongWin for every ACK received Summary: initial rate is slow but ramps up exponentially fast Host A Host B one segment RTT two segments four segments time TCP Slow Start (more)

  29. Congestion collapse: retransmission can cause network unusable. To avoid congestion collapse, must reduce transmission rate Slow-start Multiplicative decrease Multiplicative decrease congestion avoidance (exponential backoff timer): upon loss of a segment, reduce the congestion window size by half (traffic is reduced exponentially overtime). Slow-start recovery: for a new connection or after a period of congestion, increase the congestion windows size by one segment each time when ACK arrives. Response to TCP Congestion

  30. To avoid increasing the window size too quickly and causing more congestions, TCP uses congestion avoidance phase. Congestion avoidance phase Once the congestion windows reaches half of its original size, slows down the rate by increases the congestion window size by only 1 if all segments in the window have been acknowledged. Response to TCP Congestion

  31. Read Section 13.1 – 13.15, 13.20, 13.23 – 13.25,13.33 Chapter 13

More Related