Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 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)

2 Internet Layer Internet Net interface/ Physical Transport Application IP LAN Packet radio TCPUDP TelnetFTPDNS Transport Layer: UDP TCP

3 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 TCP segment structure source port # dest port # 32 bits application data (variable length) sequence number acknowledgement number Receive window Urg data pnter checksum F SR PAU head len not used Options (variable length) URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now (generally not used) RST, SYN, FIN: connection estab (setup, teardown commands) # bytes Receiver willing to accept counting by bytes of data (not segments!) Internet checksum (as in UDP) TCP minimum header size = 20 bytes

7 TCP Connection Management 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 Host A SYN, Seq=100 TCP Connection scenario Host B ACK, Seq=101, Ack=1001 time SYNACK, Seq=1000, Ack=101

8 TCP Connection Management (cont.) 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. client FIN server ACK FIN close closed timed wait

9 TCP Connection Management (cont.) 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. client FIN server ACK FIN closing closed timed wait closed

10 Stop and Wait - Diagram

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

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

13 Pipelined protocols 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

14 Go Back N - Diagram

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

16 Example Sliding Window

17 Selective Repeat 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

18 Selective repeat: sender, receiver windows

19 Selective repeat in action

20 Selective repeat:dilemma 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?

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

22 TCP retransmission scenarios (more) Host A Seq=101, 8 bytes data ACK=109 loss timeout Cumulative ACK scenario Host B X Seq=109, 16 bytes data ACK=125 time SendBase = 125 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

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

24 Principles of Congestion Control 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)

25 TCP Congestion Control 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 rate = CongWin RTT Bytes/sec

26 TCP AIMD 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

27 Response to TCP Congestion Slow-start: –Let i = i th 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?

28 TCP Slow Start (more) 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 one segment RTT Host B time two segments four segments

29 Response to TCP Congestion 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.

30 Response to TCP Congestion 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.

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


Download ppt "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."

Similar presentations


Ads by Google