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

Similar documents
Transmission Control Protocol. ITS 413 Internet Technologies and Applications

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

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

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

Chapter 3- parte B outline

TCP Overview. Connection-oriented Byte-stream

Lecture 3: The Transport Layer: UDP and TCP

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

Transport Protocols and TCP

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

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

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

Mid Term Exam Results

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

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

Congestion / Flow Control in TCP

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

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

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

CS321: Computer Networks Congestion Control in TCP

Lecture 4: Congestion Control

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

05 Transmission Control Protocol (TCP)

CSCI-1680 Transport Layer II Data over TCP Rodrigo Fonseca

CSCI-1680 Transport Layer I Rodrigo Fonseca

6. The Transport Layer and protocols

CSCI-1680 Transport Layer I Rodrigo Fonseca

CS419: Computer Networks. Lecture 10, Part 2: Apr 11, 2005 Transport: TCP mechanics (RFCs: 793, 1122, 1323, 2018, 2581)

Fall 2012: FCM 708 Bridge Foundation I

Chapter 6. What happens at the Transport Layer? Services provided Transport protocols UDP TCP Flow control Congestion control

CSCD 330 Network Programming Winter 2015

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

TCP/IP Networking. Part 4: Network and Transport Layer Protocols

10 minutes survey (anonymous)

Computer Networking Introduction

Internet Protocols Fall Outline

Arhitecturi și Protocoale de Comunicații (APC) Protocoale de nivel Transport

TCP Review. Carey Williamson Department of Computer Science University of Calgary Winter 2018

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

User Datagram Protocol (UDP):

Chapter III: Transport Layer

User Datagram Protocol

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

Chapter III: Transport Layer

Flow and Congestion Control Marcos Vieira

COMP/ELEC 429/556 Introduction to Computer Networks

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

ECE 333: Introduction to Communication Networks Fall 2001

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

CNT 6885 Network Review on Transport Layer

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

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

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

Chapter 7. The Transport Layer

Some slides courtesy David Wetherall. Communications Software. Lecture 4: Connections and Flow Control. CSE 123b. Spring 2003.

CC451 Computer Networks

Transport Layer PREPARED BY AHMED ABDEL-RAOUF

CS 356: Introduction to Computer Networks. Lecture 16: Transmission Control Protocol (TCP) Chap. 5.2, 6.3. Xiaowei Yang

Transport Over IP. CSCI 690 Michael Hutt New York Institute of Technology

Chapter 3 Transport Layer

Chapter 3 Transport Layer

Flow and Congestion Control (Hosts)

9th Slide Set Computer Networks

Transport Layer TCP / UDP

Sequence Number. Acknowledgment Number. Data

ECE 650 Systems Programming & Engineering. Spring 2018

Transport Protocols & TCP TCP

TCP Adaptive Retransmission Algorithm - Original TCP. TCP Adaptive Retransmission Algorithm Jacobson

TCP. Second phase of the project. Connection management. Flow control and congestion. Emphasizing on the followings: Three parameters: At any time

Lecture 8. TCP/IP Transport Layer (2)

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

Reliable Byte-Stream (TCP)

cs/ee 143 Communication Networks

CSC 401 Data and Computer Communications Networks

CS4700/CS5700 Fundamentals of Computer Networks

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

Introduc)on to Computer Networks

Outline Computer Networking. Functionality Split. Transport Protocols

Chapter III: Transport Layer

TCP Basics : Computer Networking. Overview. What s Different From Link Layers? Introduction to TCP. TCP reliability Assigned reading

Mobile Transport Layer Lesson 02 TCP Data Stream and Data Delivery

Page 1. Review: Internet Protocol Stack. Transport Layer Services. Design Issue EEC173B/ECS152C. Review: TCP

Reliable Transport II: TCP and Congestion Control

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

Networking Technologies and Applications

Multiple unconnected networks

Congestion Control in TCP

Internet Transport Protocols UDP and TCP

Chapter 24. Transport-Layer Protocols

TSIN02 - Internetworking

Transport Layer. <protocol, local-addr,local-port,foreign-addr,foreign-port> ϒ Client uses ephemeral ports /10 Joseph Cordina 2005

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

TCP reliable data transfer. Chapter 3 outline. TCP sender events: TCP sender (simplified) TCP: retransmission scenarios. TCP: retransmission scenarios

Transmission Control Protocol (TCP)

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

Transmission Control Protocol

UDP and TCP. Introduction. So far we have studied some data link layer protocols such as PPP which are responsible for getting data

image 3.8 KB Figure 1.6: Example Web Page

Page 1. Review: Internet Protocol Stack. Transport Layer Services EEC173B/ECS152C. Review: TCP. Transport Layer: Connectionless Service

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

Transcription:

TCP/IP Family of Protocols (cont.) TCP: Transmission Control Protocol UDP: User Datagram Protocol www.comnets.uni-bremen.de TCP - 1

Layer 4 Addressing: Port Numbers To talk to another port, a sender needs to know both the IP address and the port number at the destination Each message must carry destination IP and destination port number, as well as the source IP and source port number www.comnets.uni-bremen.de TCP - 2

What is TCP? TCP is the reliable transport protocol of TCP/IP TCP is an Automatic Repeat request (ARQ), Continuous RQ (packets are continually sent), protocol TCP utilizes acknowledgements (ACKs) TCP maintains a sliding window TCP maintains a retransmission timeout TCP uses flow and congestion control Computer Networking: A Top Down Approach Jim Kurose, Keith Ross Chapter 3: Transport Layer www.comnets.uni-bremen.de TCP - 3

Flow Control vs Congestion Control Andrew S. Tanenbaum: Computer Networks Flow control: avoid flooding the receiver Fig.(a) Congestion control: avoid flooding the network - Fig.(b) Causes of congestion in the network? www.comnets.uni-bremen.de TCP - 4

Structure of a TCP-segment Bit 0 4 8 16 32 Octet Source Port Destination Port 4 Sequence Number 8 12 Data Offset Reserved U R G Acknowledgement Number A C K P SH R ST S YN F IN buffer size of sending node used as an indication of what the node is willing to accept (advertised window size/max. window size) Window 16 Checksum Urgent Pointer 20 Options Padding Data Original TCP RFC 793, Extension for TCP is given in RFC 1323 www.comnets.uni-bremen.de TCP - 5

Code Bit (Flag) Settings URG: The data contained within this packet is urgent (i.e. keystroke data). The urgent pointer field is active and valid. ACK: The acknowledgment field is valid. PSH: Forces an immediate pushing of all data through lower layers to transmit or the pushing of all data from the transport layers to the upper layer protocols. This feature circumvents TCP s typical collection routines that may hold data before releasing to higher or lower layers if other processes are underway. RST: Reset the connection. This occurs when some unexpected event interferes with communication. SYN: Synchronize the sequence numbers. This bit initiates a communication relationship. The sender will send a packet with this code active. The receiver will acknowledge with a properly sequenced acknowledgment and its own sequence number. The sender will then respond with its own properly sequenced acknowledgment to begin the communication. FIN: Data transmission is finished. This connection is a candidate at for termination. n. www.comnets.uni-bremen.de TCP - 6

Sliding Window The window size represents the maximum amount of unacknowledged packets on flight at any given time The Sliding Window Algorithm is: Transmit all new segments according to window Wait W for acknowledgement Slide the window www.comnets.uni-bremen.de TCP - 7

Sliding Window (cont.)...3 2 1 0 [0 1 2 3] 4 5 6 7 8 9 ---------------> ACK0... (slide window) <--------------...4 0 [1 2 3 4] 5 6 7 8 9 -------------->... ACK4... (slide window) <--------------...8 7 6 5 0 1 2 3 4 [5 6 7 8] 9 --------------> www.comnets.uni-bremen.de TCP - 8

TCP Sliding Window ACKed Not ACKed 0 1 2 3 4 5 6 7 8 9 Already sent Can send Cannot send lastsegmentsent LastSegmentAcked min(cwnd, rvwnd) lastbytesent LastByteAcked min(cwnd, rvwnd) Receiver s advertised window (rwnd) Receiver-side limit on amount of data that can be sent Size advertised d by receiver Congestion window (cwnd) Sender-side limit on amount of data that can be sent Size determined by congestion control algorithms www.comnets.uni-bremen.de TCP - 9

Reaching Equilibrium P r P b Bandwidth Sender P b Receiver A s A r Time www.comnets.uni-bremen.de TCP - 10

Reaching Equilibrium (cont.) A connection is said to have reached equilibrium when: Transmitted data acquires an inter-packet spacing equal to the transmission time of the packets on the slowest link in the path www.comnets.uni-bremen.de TCP - 11

TCP - Round Trip Time Control is based on the Round Trip Time, RTT (Average) Round-Trip-Time Ti Ti estimations i RTT:=α*old_RTT + (1 - α)*new_round_trip_sample 0 α < 1, e.g. α:=0.9 α close to 1: reacts slowly to changes α close to 0: reacts quickly to changes New_Round_Trip_Sample: measured as the time between sending a segment and receiving the acknowledgement www.comnets.uni-bremen.de TCP - 12

TCP Timeout Value & Karn s Algorithm TCP timeout value TimeOut timeout:= β * RTT is based on Round-Trip-Time (RTT) estimations Seg (n) Ack (n+1) In the event of retransmission, TCP is unable to distinguish between ACKs for the same sequence number. Measured RTT Seg (n) Ack (n+1) Karn suggested to cease RTT estimations during TCP timeouts. www.comnets.uni-bremen.de TCP - 13

TCP Congestion Control End-to-end No explicit assistance from network Congestion state inferred by network observation (loss, delay) Congestion assumed if Triple duplicate ACK (4 ACKs with same seq. no.) Timeout: no ACK received for predefined time Algorithms [RFC5681]: Slow Start Congestion Avoidance Fast Retransmit Fast Recovery www.comnets.uni-bremen.de TCP - 14

Slow-Start Aims to identify link capacity Algorithm Description: 1. Start sending one packet 2. For each ACK received, send two packets Slow-Start forces an exponential increase of cwnd (congestion window size) cwnd doubles after approx. RTT cwnd reaches maximum size (MaxWin) in RTT*log 2 (MaxWin) www.comnets.uni-bremen.de TCP - 15

Congestion Avoidance (state) Congestion Avoidance is always implemented with Slow-Start: When an ACK is received: if (cwnd <= ssthresh) cwnd += 1; else cwnd += 1/cwnd; If a timeout occurs: ssthresh=cwnd/2; cwnd=1 AIMD: Additive Increase and Multiplicative Decrease www.comnets.uni-bremen.de TCP - 16

TCP Congestion Control ssthresh cwnd in seg gments 14 12 10 8 6 congestion avoidance Time out congestion avoidance ssthresh = cwnd/2 4 2 slow start slow start 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Transmission Round Aims to preserve equilibrium: if cwnd <= ssthresh slow start else congestion avoidance Endif www.comnets.uni-bremen.de TCP - 17

Fast Retransmit Aims to avoid long timeout intervals TCP may only acknowledge in order received packets TCP does not utilize NACKs In the event of single packet loss all subsequent packets are received out-of-orderof order TCP responds with duplicate ACKs (dupacks) If the dupacks exceed a threshold, TCP responds with retransmission without prior timeout Fast Retransmit is succeeded by Slow-Start www.comnets.uni-bremen.de TCP - 18

Fat Retransmit and Fast Recovery Aims at a faster window recovery Fast Recovery dictates that Fast Retransmit should be followed by Congestion Avoidance: When a dupack is received: if (dupack = 3) { retransmit(last); ssthresh = min(cwnd,advwnd)/2; cwnd = ssthresh + 3; else cwnd += 1/cwnd; When an ACK for retransmitted segment is received: cwnd = ssthresh; Se egment Sent 56 57 58 59 60 ACK received 57 58 58 58 61 58 58 62 www.comnets.uni-bremen.de TCP - 19

Fast Retransmit and Fast Recovery ssthresh cwnd in seg gments 14 12 10 8 congestion avoidance 3 DupAcks congestion avoidance 6 ssthresh = cwnd/2 4 2 slow start 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Transmission Round How comes 3 DupAcks? www.comnets.uni-bremen.de TCP - 20

TCP Flavors: Reno & Tahoe www.comnets.uni-bremen.de TCP - 21

TCP A Opening a TCP-connection TCP B 3-Way Handshake Protocol www.comnets.uni-bremen.de TCP - 22

2K Segment TCP Data Transmission Receiver Buffer (rwnd) 0K 4K Empty 2K 3K from App For simplicity, initial seq. num is set to 0 www.comnets.uni-bremen.de TCP - 23

TCP A Closing a TCP-connection TCP B Sends segment with activated FIN Flag Connection from A to B closed Receives FIN segment and informs application layer Sends confirmation Sends segment with activated FIN Flag Receives FIN segment and confirms receipt Connection from B to A closed www.comnets.uni-bremen.de TCP - 24

TCP: finite state machine/ state transition diagram begin passive open syn/syn + ack anything/reset CLOSED close active open/syn (1) LISTEN SYN RECVD reset ack send/syn syn/syn + ack syn + ack/ack (2) SYN SENT close/ time out/ reset A connection starts with the state CLOSED. Input/Output denotes the input causing a state transition and the output generated. FIN WAIT-1 close/fin close/fin fin/ack ESTAB- LISHED CLOSING fin/ack (3) close/fin CLOSE WAIT LAST ACK ack/ ack/ FIN WAIT-2 fin/ack ack/ TIME WAIT timeout after 2 segment lifetimes www.comnets.uni-bremen.de TCP - 25

4.3BSD Tahoe Slow-start with Congestion Avoidance 100 90 Congestion Window Slow-start t Threshold h 80 70 60 Packets 50 40 30 20 10 0 0 10 20 30 40 50 60 70 80 90 100 Time (seconds) www.comnets.uni-bremen.de TCP - 26

4.3BSD Tahoe Packet Trace 2500 TCP Packet Dropped Packets 2000 (Sequence Numb TCP Packets er) 1500 1000 500 0 0 10 20 30 40 50 60 70 80 90 100 Time (seconds) www.comnets.uni-bremen.de TCP - 27

4.3BSD Reno 4.3BSD Tahoe with Fast Retransmit & Recovery 100 90 Congestion Window Slow-start t Threshold h 80 70 60 Packets 50 40 30 20 10 0 0 10 20 30 40 50 60 70 80 90 100 Time (seconds) www.comnets.uni-bremen.de TCP - 28

4.3BSD Reno Packet Trace 2500 TCP Packet Dropped Packets 2000 (Sequence Numb TCP Packets er) 1500 1000 500 0 0 10 20 30 40 50 60 70 80 90 100 Time (seconds) www.comnets.uni-bremen.de TCP - 29

www.comnets.uni-bremen.de TCP - 30

Summary: TCP 3-way handshake h Reliable transport Sequence numbers Acknowledgements Timers TCP Flow Control Prevent overload at receiver Use sliding window, self-clocking TCP Congestion Control Prevent overload in network, ensure fairness Adapt sending rate based on observed congestion www.comnets.uni-bremen.de TCP - 31

Problems with TCP TCP provokes packet losses to get an idea about the state of the network. The protocol has no explicit feedback only implicit feedback when something goes wrong. The use of the available bandwidth oscillates. This means that the load of the network varies; small load: space left, unused available capacity overload: network overflow, packet losses, delays, retransmissions, i.e. slower than it has to be. There has been a shift in the Internet traffic. Due to short transmissions, TCP is almost always in slow start, measurements show 85% in slow start. There is no difference between different trace classes, such as ftp files, video streams or e-mail. Originally i less than 1% packet losses, now 5-7%, which means many retransmissions (13%), most of which are due to timeouts. TCP always assumes that packet losses are due to congestion. Problem in Mobile Networks!!! www.comnets.uni-bremen.de TCP - 32