Sequence Number. Acknowledgment Number. Data

Similar documents
7. TCP 최양희서울대학교컴퓨터공학부

05 Transmission Control Protocol (TCP)

Networking Technologies and Applications

Connection-oriented (virtual circuit) Reliable Transfer Buffered Transfer Unstructured Stream Full Duplex Point-to-point Connection End-to-end service

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

User Datagram Protocol

Transmission Control Protocol. ITS 413 Internet Technologies and Applications

Lecture 3: The Transport Layer: UDP and TCP

Transport Layer. Application / Transport Interface. Transport Layer Services. Transport Layer Connections

Data Link Layer, Part 5 Sliding Window Protocols. Preface

Transmission Control Protocol (TCP)

User Datagram Protocol (UDP):

Data Link Layer, Part 4. Exemplary Protocols

6.1 Internet Transport Layer Architecture 6.2 UDP (User Datagram Protocol) 6.3 TCP (Transmission Control Protocol) 6. Transport Layer 6-1

TCP : Fundamentals of Computer Networks Bill Nace

Kent State University

UNIT IV -- TRANSPORT LAYER

Transport Protocols & TCP TCP

Transport Layer: outline

Introduction to Networking. Operating Systems In Depth XXVII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

Chapter 24. Transport-Layer Protocols

CS457 Transport Protocols. CS 457 Fall 2014

ETSF05/ETSF10 Internet Protocols Transport Layer Protocols

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

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

CSCD 330 Network Programming

ITS323: Introduction to Data Communications

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

Transport Protocols and TCP: Review

Multiple unconnected networks

Transport layer. Review principles: Instantiation in the Internet UDP TCP. Reliable data transfer Flow control Congestion control

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

Transport Layer: Outline

Transport Protocols. Raj Jain. Washington University in St. Louis

Introduction to Networks and the Internet

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2. Goals for Todayʼs Lecture. Role of Transport Layer

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

Transport Layer Marcos Vieira

TSIN02 - Internetworking

Congestion / Flow Control in TCP

Applied Networks & Security

Programming Assignment 3: Transmission Control Protocol

ECE 650 Systems Programming & Engineering. Spring 2018

EEC-484/584 Computer Networks. Lecture 16. Wenbing Zhao

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

CSC 401 Data and Computer Communications Networks

CSC 634: Networks Programming

CS4700/CS5700 Fundamentals of Computer Networks

Information Network 1 TCP 1/2. Youki Kadobayashi NAIST

Two approaches to Flow Control. Cranking up to speed. Sliding windows in action

Internet and Intranet Protocols and Applications

The Transport Layer: TCP & Reliable Data Transfer

TCP = Transmission Control Protocol Connection-oriented protocol Provides a reliable unicast end-to-end byte stream over an unreliable internetwork.

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

ECE697AA Lecture 3. Today s lecture

Transport Protocols. ISO Defined Types of Network Service: rate and acceptable rate of signaled failures.

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

Introduction to Protocols

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 25, 2018

NWEN 243. Networked Applications. Layer 4 TCP and UDP

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

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

TSIN02 - Internetworking

Unit 2.

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

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

Introduction to TCP/IP networking

TCP Service Model. Today s Lecture. TCP Support for Reliable Delivery. EE 122:TCP, Connection Setup, Reliability

CCNA 1 Chapter 7 v5.0 Exam Answers 2013

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

Network Protocols. Transmission Control Protocol (TCP) TDC375 Autumn 2009/10 John Kristoff DePaul University 1

CS 5520/ECE 5590NA: Network Architecture I Spring Lecture 13: UDP and TCP

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

CS 640 Introduction to Computer Networks Spring 2009

CSCI-GA Operating Systems. Networking. Hubertus Franke

Reliable Transport I: Concepts and TCP Protocol

COMP/ELEC 429/556 Introduction to Computer Networks

Chapter 5 End-to-End Protocols

TCP: Flow and Error Control

ECE 333: Introduction to Communication Networks Fall 2001

Network Technology 1 5th - Transport Protocol. Mario Lombardo -

QUIZ: Longest Matching Prefix

TSIN02 - Internetworking

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

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

TSIN02 - Internetworking

Outline. CS5984 Mobile Computing

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

Mobile Transport Layer Lesson 02 TCP Data Stream and Data Delivery

I TCP 1/2. Internet TA: Connection-oriented (virtual circuit) Connectionless (datagram) (flow control) (congestion control) TCP Connection-oriented

The aim of this unit is to review the main concepts related to TCP and UDP transport protocols, as well as application protocols. These concepts are

Chapter 3 Transport Layer

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

What is TCP? Transport Layer Protocol

Computer Networks and Data Systems

TCP: Transmission Control Protocol UDP: User Datagram Protocol TCP - 1

Announcements Computer Networking. Outline. Transport Protocols. Transport introduction. Error recovery & flow control. Mid-semester grades

Reliable Transport I: Concepts and TCP Protocol

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

CSE 4213: Computer Networks II

Transcription:

CS 455 TCP, Page 1 Transport Layer, Part II Transmission Control Protocol These slides are created by Dr. Yih Huang of George Mason University. Students registered in Dr. Huang's courses at GMU can make asingle machine-readable copy and print a single copy of each slide for their own reference, so long as each slide contains the copyright statement, and GMU facilities are not used to produce paper copies. Permission for any other use, either in machine-readable or printed form, must be obtained from the author in writing. CS 455 TCP, Page 2 Introduction ffl TCP provides reliable, stream delivery service, full-duplex (that is, bidirectional) communication, error control, flow/congestion control (that is, sliding window), and rules for connection establishment and destruction. ffl TCP does not include application program interfaces (API); these are provided by operating systems.

CS 455 TCP, Page 3 Stream Delivery Service ffl Data from each upper-layer application are treated as a stream of bytes. ffl The stream is divided into segments for delivery as IP datagrams. this is division is up to TCP; application-level data boundary are ignored ffl The sequence number of a segment designates the offset of the segment in the stream. conceptually, there is a sequence # associated with every byte only the sequence # of the first byte in the segment is sent ffl Window sizes are also in bytes (as opposed to the number of frames). CS 455 TCP, Page 4 Forced Data Delivery ffl Imagine that you rlogin to site.gmu.edu and issue an ls command. ffl While you wait for responses, your TCP module considers three bytes ( l", s", and return) too small a segment and decides to wait for additional bytes before sending the segment. you are not going to see any responses until you issue more commands to make the TCP module happy. ffl In general, applications need a way to force TCP to deliver data immediately. ffl This is achieved by setting a PSH bit to 1 in TCP header.

CS 455 TCP, Page 5 Urgent Data ffl TCP also provides a way to urgently deliver a part of the data stream to the receiving process, regardless the position of that part in the stream. ffl This is achieved by encapsulating the urgent data in a segment whose URG bit is set to 1. ffl Also, the Urgent Pointer field in TCP header allows you to specify where the urgent data ends. ffl Application? CS 455 TCP, Page 6 TCP Segment Format 0 15 16 31 Source Port Destination Port Sequence Number 4 bit HLEN unused Acknowledgment Number U R G A C K P S H TCP Checksum R S S Y T N F I N Window Size Urgent Pointer 20 bytes Data

CS 455 TCP, Page 7 TCP Encapsulation IP datagram IP data IP Header 20 bytes TCP Header 20 bytes TCP Segment TCP Data CS 455 TCP, Page 8 The Concept of Connections ffl Like UDP, TCP uses port numbers to specify destinations with a machine. ffl Unlike UDP, TCP uses connections, not ports, as its fundamental abstraction. a connection is identified by a pair of endpoints an endpoint is a (IP address, port) pair. ffl Examples: three connections involving site.gmu.edu 1. (18.26.0.36, 53) and (129.174.40.83, 25) 2. (128.9.4.33, 2000) and (129.174.40.83, 1069) 3. (196.83.4.22, 64) and (129.174.40.83, 25) ffl Please notice the reuse of port 25.

CS 455 TCP, Page 9 Connection Establishment ffl At the first look, this seems to be easy: one party sends a connect request message, and the other party either accepts or rejects the request. ffl It turns out to be tricky. Why? ffl Solution? choose initial sequence number (ISN) based on current time include the ISN in the connection request message if the request message has to be re-transmitted, a new ISN will be chosen this enables us to recognize obsolete request messages CS 455 TCP, Page 10 Three-Way Hand Shaking Consider that machine A initiates a connection to machine B. ffl A sends Basegment, with the sequence number set to x the current ISN set according to A's clock, and SYN bit set to 1; this is the connection request message. the ACK flag is set to 0, for this segment contains no Ack number this segment is still a regular TCP segment it can carry data too however, if it does contain data, machine B cannot deliver the data to application until B is assured of the establishment of the connection

CS 455 TCP, Page 11 ffl In response, B returns a segment whose Ack number is set to x + 1, seq number set to y (the ISN according to B's clock), and SYN set to 1; this is the connection acceptance message. if the first segment from A contains b bytes of data, the returned Ack number is x + b +1 this segment itself can contain data too ffl When A receives the message, A considers the connection established. Moreover, A immediately sends B a segment whose Ack number is set to y +1and SYN set to 1; this is the connection confirmation message. ffl Only after B receives the confirmation will it consider the connection established. CS 455 TCP, Page 12 Examples Scenario 1: normal situation 1. A to B: SYN=1, ACK=0, seq=100 2. B to A: SYN=1, seq=523, ack=101 3. A to B: SYN=1, seq=101, ack=523 4. A to B: SYN=0, seq=101, ack=523, data

CS 455 TCP, Page 13 Scenario 2: handling duplicates of connection request 1. A to B: SYN=1, ACK=0, seq=100 (queued in the network) 2. A to B: SYN=1, ACK=0, seq=120 3. B to A: SYN=1, seq=523, ack=121 4. A to B: SYN=1, seq=121, ack=523 5. A to B: SYN=0, seq=121, ack=523, data... Assume that the first request message later arrives at B. 6. B to A: SYN=1, seq=888, ack=101 7. A to B: SYN=1, RST=1, seq=101 CS 455 TCP, Page 14 Closing A Connection Consider a connection between A and B. ffl When A sends its last segment, it sets the FIN bit to 1. ffl For A, the connection is released when the last segment is acknowledged. ffl Even so, B can continue sending data to A until it uses the above method to finish its transmission. ffl The connection is automatically released if it has been quite for too long.

CS 455 TCP, Page 15 TCP Sliding Window Protocol ffl TCP uses a go-back-n protocol that uses only positive acknowledgments. ffl The sliding window protocol of the TCP must work with dynamic conditions. ffl Specifically, an endpoint of a connection need to adjust its behavior for the following reasons: the other end is overwhelmed (this happens at DLL too) the network may be congested (unique to TL) fluctuations in background traffic" (unique to TL) ffl Consequently, the timeout interval and window size of a TCP connection change their values in response to changes in network conditions. CS 455 TCP, Page 16 Window Size Advertisement ffl Unlike DLL, the size of sliding windows are not fixed. ffl In TCP, the receiver selects the size of a window that it uses to buffer in-bound data. Recall that TCP uses go-back-n. Why does the receiver need a window? ffl When the receiver returns a (piggybacked) ACK to the sender, it uses the Window Size" field in the TCP header to indicate the available space (in bytes) in its window. ffl The sender adjusts its window size in order not to overflow the receiver window.

CS 455 TCP, Page 17 TCP Windows data waiting for transmission ******************************** sender window (data transmitted but not yet acked) data transmission ************************ reciver window (data received but not yet retrieved by the application) data retrieved ffl What happens when the source process wishes to send and the sender TCP window is full? ffl What happens when the receiving process wishes to retrieve information when the receiver window is empty? CS 455 TCP, Page 18 Timeout Interval ffl Problem: difficult to determine a correct value for timeout interval over. If the timeout interval is too short, unnecessary retransmissions occur. If the timer is too long, performance suffers due to long retransmission delays. hosts possess no knowledge about network topology and have no way to know the round trip time before communication further, round trip times between two points vary over time due to changes in network workload

CS 455 TCP, Page 19 An Early Solution ffl When an out-going packet is stored in the window, the current time is recorded. ffl The round trip time of the packet can easily be computed when its acknowledgment arrives. ffl At a machine, a variable RTT is maintained for each connection of the machine. ffl Each time an acknowledgment pertaining to the connection arrives: RTT = ff * RTT + (1 ff) * New Round Trip Sample, where ff is called the smoothing factor, recommended to be 0:9. ffl Timeout interval is set to fi * RTT, where constant fi is recommended to be 2. CS 455 TCP, Page 20 Discussion ffl In essence, this method computes the average round trip time and sets the timeout interval accordingly. ffl However, variance is not taken into account. ffl What is your choice of timeout interval if the past three round-trip samples are 1. 10, 9.1, and 10.1 seconds 2. 1, 20, and 9 seconds

CS 455 TCP, Page 21 Responding to Variance ffl Associated with each connection is a second variable DEV, used to estimate the mean deviation of round trip times. ffl Whenever an ACK pertaining to a connection arrives, a new round trip time sample, denoted by SAMPLE, is obtained. The timeout interval is updated as follows. DIFF = SAMPLE - RTT RTT = RTT + ffi Λ DIFF DEV = DEV + ρ Λ (jdiffj DEV) where ffi is recommended to be 1=8, ρ 1=4, and fi 4. Timeout = RTT + fi Λ DEV CS 455 TCP, Page 22 Retransmission Ambiguity Problem ffl Consider a packet with sequence number x that is first transmitted at time t 1 and then retransmitted at time t 0 1. ffl An ACK with sequence number x arrives at time t 2. ffl What is value of the new RTT sample? t 2 t 1? t 2 t 0 1? ffl Solution: simply discard all samples pertaining to packets that have been retransmitted? Problem?

CS 455 TCP, Page 23 Karn's Algorithm ffl When computing the RTT estimate, ignore all round-trip time samples that correspond to retransmitted segments. ffl Further, when an ACK that corresponds to a retransmitted packet arrives, double the timeout interval. ffl Derive the timeout interval from variable RTT when a valid RTT sample arrives. CS 455 TCP, Page 24 Network Congestion ffl When the network is congested (that is, there are more packets then routers can handle), packets are buffered, or queued, at routers. ffl When congestion worsens, routers run out of buffer space and have no choice but to drop packets. ffl In response, users of the network (in this talk, TL modules running at hosts) must reduce traffic load, or else the problem will persist.

CS 455 TCP, Page 25 ffl Recall that when the timeout interval of a segment expires, the host cannot be certain about the cause. segment lost due to transmission errors? ACK lost due to transmission errors? receiver too busy to respond? network overloaded? ffl What should the host do upon the loss of a segment? CS 455 TCP, Page 26 Multiplicative Decrease and Additive Recovery ffl Multiplicative Decrease: Upon the loss of a segment, reduce the window size by half (down to a minimum of one segment), and double the timeout interval. this forces the hosts to rapidly reduce their traffic ffl Additive Recovery: If there has been no packet lost for a period of time, increase the window size by 1 (up to the size advertised by the receiver) each time an ACK arrives, and compute the timeout interval according to RTT estimate.

CS 455 TCP, Page 27 TCP Options Optional header information can be added before the payload (data), indicated by header length > 5 Λ 4 bytes. ffl receiver indicated maximum segment size ffl Negative acknowledgments ffl selective repeat ffl 32-bit checksums CS 455 TCP, Page 28 Concluding Remark ffl TCP is a relatively complicated protocol. ffl However, it has the advantage of being used for a long period of time. Many of its problems have been ironed out. ffl It has been shown to work reasonably well under drastically different circumstances: workstations/pcs over WANs supercomputers over LANs long bulky traffic short conversations