CS321: Computer Networks Error and Flow Control in TCP

Similar documents
CSC 4900 Computer Networks: TCP

Chapter 24. Transport-Layer Protocols

Chapter 3 Review Questions

Fall 2012: FCM 708 Bridge Foundation I

TCP: Flow and Error Control

Lecture 08: The Transport Layer (Part 2) The Transport Layer Protocol (TCP) Dr. Anis Koubaa

32 bits. source port # dest port # sequence number acknowledgement number not used. checksum. Options (variable length)

Transport Layer: Outline

CS321: Computer Networks Congestion Control in TCP

CSCD 330 Network Programming

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 9

CSCE 463/612 Networks and Distributed Processing Spring 2017

CS419: Computer Networks. Lecture 10, Part 3: Apr 13, 2005 Transport: TCP performance

10 minutes survey (anonymous)

Lecture 8. TCP/IP Transport Layer (2)

Transport Layer: outline

The Transport Layer: TCP & Reliable Data Transfer

TCP. TCP: Overview. TCP Segment Structure. Maximum Segment Size (MSS) Computer Networks 10/19/2009. CSC 257/457 - Fall

TCP (Part 2) Session 10 INST 346 Technologies, Infrastructure and Architecture

23-3 TCP. Topics discussed in this section: TCP Services TCP Features Segment A TCP Connection Flow Control Error Control 23.22

Correcting mistakes. TCP: Overview RFCs: 793, 1122, 1323, 2018, TCP seq. # s and ACKs. GBN in action. TCP segment structure

Chapter 3 Transport Layer

Chapter 3 outline. 3.5 connection-oriented transport: TCP segment structure reliable data transfer flow control connection management

Computer Networking Introduction

CSC 401 Data and Computer Communications Networks

TCP. 1 Administrivia. Tom Kelliher, CS 325. Apr. 2, Announcements. Assignment. Read From Last Time

ICS 451: Today's plan. Sliding Window Reliable Transmission Acknowledgements Windows and Bandwidth-Delay Product Retransmission Timers Connections

Chapter 3 Transport Layer

Lecture 20 Overview. Last Lecture. This Lecture. Next Lecture. Transport Control Protocol (1) Transport Control Protocol (2) Source: chapters 23, 24

file:///c:/users/hpguo/dropbox/website/teaching/fall 2017/CS4470/H...

Computer Communication Networks Midterm Review

CSC 8560 Computer Networks: TCP

CS 4390 Computer Networks. Pointers to Corresponding Section of Textbook

Chapter 3- parte B outline

Chapter III: Transport Layer

CS450 Introduc0on to Networking Lecture 14 TCP. Phu Phung Feb 13, 2015

Chapter 3 Transport Layer

Department of Computer and IT Engineering University of Kurdistan. Transport Layer. By: Dr. Alireza Abdollahpouri

Transmission Control Protocol (TCP)

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, steam: r Development of reliable protocol r Sliding window protocols

Outline. CS5984 Mobile Computing

FINAL May 21, minutes

11/24/2009. Fundamentals of Computer Networks ECE 478/578. Flow Control in TCP

Transport Protocols and TCP

IS370 Data Communications and Computer Networks. Chapter 5 : Transport Layer

Homework 3 50 points. 1. Computing TCP's RTT and timeout values (10 points)

Chapter 3 outline. 3.5 Connection-oriented transport: TCP. 3.6 Principles of congestion control 3.7 TCP congestion control

TCP Review. CS144 Review Session 4 April 25, 2008 Ben Nham

Outline. Connecting to the access network: DHCP and mobile IP, LTE. Transport layer: UDP and TCP

Computer Networking: A Top Down Approach

The Transport Layer Reliability

CSE 4213: Computer Networks II

CS Lecture 1 Review of Basic Protocols

Outline. TCP: Overview RFCs: 793, 1122, 1323, 2018, Development of reliable protocol Sliding window protocols

Suprakash Datta. Office: CSEB 3043 Phone: ext Course page:

05 Transmission Control Protocol (TCP)

Flow and Congestion Control (Hosts)

Intro to LAN/WAN. Transport Layer

a) Adding the two bytes gives Taking the one s complement gives

Chapter 3 Transport Layer

Basic Reliable Transport Protocols

COMP 431 Internet Services & Protocols. Transport Layer Protocols & Services Outline. The Transport Layer Reliable data delivery & flow control in TCP

Review Questions for Midterm Exam-2 Fall 2016

CS118 Discussion 1A, Week 4. Zengwen Yuan Dodd Hall 78, Friday 10:00 11:50 a.m.

TCP : Fundamentals of Computer Networks Bill Nace

Transport Protocols and TCP: Review

LECTURE 3 - TRANSPORT LAYER

Chapter III: Transport Layer

Chapter 23 Process-to-Process Delivery: UDP, TCP, and SCTP 23.1

CS 43: Computer Networks. 19: TCP Flow and Congestion Control October 31, Nov 2, 2018

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4021: Networks Discussion. Chapter 5 - Part 2

The Transport Layer Reliable data delivery & flow control in TCP. Transport Layer Protocols & Services Outline

User Datagram Protocol (UDP):

Lecture 5: Flow Control. CSE 123: Computer Networks Alex C. Snoeren

CC451 Computer Networks

Kent State University

Transport Protocols & TCP TCP

Reliable Transport II: TCP and Congestion Control

Practice Problems: P22, 23, P24, P25, P26, P27, P28, P29, P30, P32, P44 and P45. Hand-in the following: P27, P28, P32, P37, P44

Guide To TCP/IP, Second Edition UDP Header Source Port Number (16 bits) IP HEADER Protocol Field = 17 Destination Port Number (16 bit) 15 16

UNIT IV -- TRANSPORT LAYER

Sequence Number. Acknowledgment Number. Data

Transport Layer PREPARED BY AHMED ABDEL-RAOUF

Flow and Congestion Control Marcos Vieira

TSIN02 - Internetworking

Problem. Chapter Outline. Chapter Goal. End-to-end Protocols. End-to-end Protocols. Chapter 5. End-to-End Protocols

Transmission Control Protocol

Reliable Transport I: Concepts and TCP Protocol

Transport Layer. -UDP (User Datagram Protocol) -TCP (Transport Control Protocol)

Lecture 5. Transport Layer. Transport Layer 1-1

The Transport Layer Reliable data delivery & flow control in TCP. Transport Layer Protocols & Services Outline

Computer Networks. Homework #4: No Grading

TCP and Congestion Control (Day 1) Yoshifumi Nishida Sony Computer Science Labs, Inc. Today's Lecture

TCP. CSU CS557, Spring 2018 Instructor: Lorenzo De Carli (Slides by Christos Papadopoulos, remixed by Lorenzo De Carli)

Problem 7. Problem 8. Problem 9

Lecture 12: Transport Layer TCP again

Internet Protocols Fall Outline

TCP: Overview RFCs: 793, 1122, 1323, 2018, 2581

Chapter 3 Transport Layer

Transport layer. UDP: User Datagram Protocol [RFC 768] Review principles: Instantiation in the Internet UDP TCP

Transcription:

CS321: Computer Networks Error and Flow Control in TCP Dr. Manas Khatua Assistant Professor Dept. of CSE IIT Jodhpur E-mail: manaskhatua@iitj.ac.in

SEQ and ACK numbers in TCP TCP views data as an unstructured, but ordered, stream of bytes The SEQ number for a segment is the byte-stream number of the first byte in the segment. The ACK number that Host A puts in its segment is the SEQ number of the next byte Host A is expecting from Host B. 18-02-2018 Dr. Manas Khatua 2

Error Control in TCP Error control in TCP is done by : checksum, ACK, time-out By default TCP uses cumulative ACK When does a receiver generate ACK? Rule-1: when node A sends data to node B, it piggybacks ACK Rule-2: the receiver has no data to send and it receives an in-order segment, it delays sending ACK Rule-3: there should not be more than two in-order unacked segments at any time (it is delayed ACK) Rule-4: when a segment arrives with an out-of-order sequence number; or, it is fast retransmission of missing segments Rule-5: when a missing segment arrives Rule-6: If a duplicate segment arrives 18-02-2018 Dr. Manas Khatua 3

Cont When retransmission happens? After time-out: sending TCP maintains one retransmission time-out (RTO) for each connection Three duplicate ACK rule: if three duplicate ACK (i.e., an original ACK + three exactly identical copies) arrive for a segment, the next segment is retransmitted without waiting for the time-out. Why three duplicate ACK? Since TCP does not know whether a duplicate ACK is caused by a lost segment or just a reordering of segments, it waits for at max two duplicate ACK. If three or more duplicate ACKs are received in a row, it is a strong indication that a segment has been lost. Data may arrive out of order and be temporarily stored by the receiving TCP, but TCP guarantees that no out-of-order data are delivered to the process. 18-02-2018 Dr. Manas Khatua 4

RTT Estimation and Timeout TCP uses a timeout/retransmit mechanism to recover from lost segments. The timeout should be larger than the connection s round-trip time (RTT) Few Questions: How much larger? How should the RTT be estimated in the first place? Should a timer be associated with each and every unacked segment? The sample RTT, denoted SampleRTT, for a segment is the amount of time between when the segment is sent (that is, passed to IP) and when an ACK for the segment is received. But, the SampleRTT values will fluctuate from segment to segment due to congestion in the routers and to the varying load on the end systems. Solution: TCP maintains an average, called EstimatedRTT, of the SampleRTT values. Exponentially weighted moving average (EWMA) EstimatedRTT = (1 α) x EstimatedRTT + α x SampleRTT The recommended value of α is = 1/8 18-02-2018 Dr. Manas Khatua 5

Cont It is also valuable to have a measure of the variability of the RTT. DevRTT = (1 β) x DevRTT + β x SampleRTT EstimatedRTT The recommended value of β is 1/4. For little fluctuation, the DevRTT will be small; on the other hand, for lot of fluctuation, DevRTT will be large. It is desirable to set the timeout equal to the EstimatedRTT plus some margin. The margin should be large when there is a lot of fluctuation in the SampleRTT values; it should be small when there is little fluctuation. TimeoutInterval = EstimatedRTT + 4 x DevRTT Another Question: How long the receiver waits before sending a stand-alone ACK to acknowledge data on a TCP socket? Delayed ACK was invented to reduce the number of ACKs required to acknowledge the segments, so protocol overhead is reduced. A host may delay sending an ACK response by up to 500 ms. However, a stand-alone ACK is sent if two full packets worth of data arrive before the delayed ACK timer expires. 18-02-2018 Dr. Manas Khatua 6

Example : Normal Scenario The client TCP sends one segment (2000 byte); server TCP sends three segments (3 x 1000 byte). 18-02-2018 Dr. Manas Khatua 7

Example : Lost Segment Scenario assuming that data transfer is unidirectional from client to server 18-02-2018 Dr. Manas Khatua 8

Example : Fast Retransmission 18-02-2018 Dr. Manas Khatua 9

Example : Lost ACK 18-02-2018 Dr. Manas Khatua 10

Flow Control in TCP The receiving TCP controls the sending TCP; the sending TCP controls the sending process. No flow control between receiving TCP and receiving process. To achieve flow control: TCP forces the sender and the receiver to adjust their window sizes, although the size of the buffer for both parties is fixed when the connection is established. The opening, closing, and shrinking of the send window is controlled by the receiver. 18-02-2018 Dr. Manas Khatua 11

Send Window in TCP TCP uses Send window & Receive window Let send window size = 100 18-02-2018 Dr. Manas Khatua 12

Modified SR (for Send Window) Sending window in TCP follows Selective-Repeat (SR) protocol with few modifications The window size in SR is the number of packets, but the window size in TCP is the number of bytes. TCP can store data received from the process and send them later SR requires individual ACK of each packet that was sent; but TCP sends ACK for the next packet that it is expecting (like Go-back-N) SR protocol may use several timers for general transmission and selected retransmission, but TCP protocol uses only one timer. Window size can be changed dynamically in TCP 18-02-2018 Dr. Manas Khatua 13

Receive Window in TCP 18-02-2018 Dr. Manas Khatua 14

Modified SR (for Receive Window) Receive window in TCP is little different than that in SR TCP allows the receiving process to pull data at its own pace. The receive window size (rwnd) determines the number of bytes that the receive window can accept from the sender before being overwhelmed (flow control). rwnd = buffer size - number of bytes waiting to be pulled ACK in SR is selective, but ACK in TCP is cumulative. Similarly, retransmission is selective in SR, but oldest unacked segment is retransmitted in TCP 18-02-2018 Dr. Manas Khatua 15

Example (oneway from client to server) Buffer Size = 800 18-02-2018 Dr. Manas Khatua 16

Shrinking of Windows new ackno + new rwnd >= last ackno + last rwnd If rwnd==0, it instructs for window shutdown 18-02-2018 Dr. Manas Khatua 17

Silly Window Syndrome Performance issue occurs when Sending application program creates data slowly OR, Receiving application program receives data slowly OR, For both the above Example: Sending process generating each byte very slowly Sending TCP sends many 41 bytes segment (20 byte TCP header + 20 byte IP header + 1 byte data) Two types to address Syndrome created by sender Syndrome created by receiver 18-02-2018 Dr. Manas Khatua 18

Solution Naïve solution faces a trade-off optimization If TCP waits too long, it may delay the process If TCP does not wait for long, it may end up sending small segment Better Solution for sender: Nagle s Algorithm Sending TCP sends the 1 st segment as it is 2 nd segment onwards, the sending TCP accumulates data in sending buffer and waits until Either the receiving TCP sends an ACK Or enough data have accumulated to fill the maximum-size segment Better Solution for receiver: Clark s two algorithms First algorithm: send an ACK as soon as the data arrive, but to announce a window size of zero until either there is enough space to accommodate a segment of maximum size or until at least half of the receive buffer is empty. Second algorithm: delay sending the ACK. The receiver waits until there is a decent amount of space in its incoming buffer before ACKing the arrived segments. 18-02-2018 Dr. Manas Khatua 19

18-02-2018 Dr. Manas Khatua 20