TCP. TCP: Overview. TCP Segment Structure. TCP Reliable Data Transfer. Kai Shen Dept. of Computer Science, University of Rochester

Similar documents
Transport Layer and Data Center TCP

Computer Networks. Chapter 5 Transport Protocols

Transport Layer Protocols

Outline. TCP connection setup/data transfer Computer Networking. TCP Reliability. Congestion sources and collapse. Congestion control basics

B-2 Analyzing TCP/IP Networks with Wireshark. Ray Tompkins Founder of Gearbit

COMP 3331/9331: Computer Networks and Applications. Lab Exercise 3: TCP and UDP (Solutions)

This sequence diagram was generated with EventStudio System Designer (

Chapter 5. Transport layer protocols

TCP Flow Control. TCP Receiver Window. Sliding Window. Computer Networks. Lecture 30: Flow Control, Reliable Delivery

ICOM : Computer Networks Chapter 6: The Transport Layer. By Dr Yi Qian Department of Electronic and Computer Engineering Fall 2006 UPRM

TCP Performance Management for Dummies

[Prof. Rupesh G Vaishnav] Page 1

Computer Networks UDP and TCP

TCP in Wireless Mobile Networks

La couche transport dans l'internet (la suite TCP/IP)

15-441: Computer Networks Homework 2 Solution

Names & Addresses. Names & Addresses. Hop-by-Hop Packet Forwarding. Longest-Prefix-Match Forwarding. Longest-Prefix-Match Forwarding

q Connection establishment (if connection-oriented) q Data transfer q Connection release (if conn-oriented) q Addressing the transport user

First Midterm for ECE374 03/09/12 Solution!!

Networking Overview. (as usual, thanks to Dave Wagner and Vern Paxson)

Transport Layer. Chapter 3.4. Think about

Higher Layer Protocols: UDP, TCP, ATM, MPLS

Prefix AggregaNon. Company X and Company Y connect to the same ISP, and they are assigned the prefixes:

TCP/IP Optimization for Wide Area Storage Networks. Dr. Joseph L White Juniper Networks

CSE331: Introduction to Networks and Security. Lecture 9 Fall 2006

TCP over Multi-hop Wireless Networks * Overview of Transmission Control Protocol / Internet Protocol (TCP/IP) Internet Protocol (IP)

Computer Networks - CS132/EECS148 - Spring

La couche transport dans l'internet (la suite TCP/IP)

Network Security in Practice

Visualizations and Correlations in Troubleshooting

Improving the Performance of TCP Using Window Adjustment Procedure and Bandwidth Estimation

Ethernet. Ethernet. Network Devices

CSE 473 Introduction to Computer Networks. Exam 2 Solutions. Your name: 10/31/2013

2 TCP-like Design. Answer

Final for ECE374 05/06/13 Solution!!

Overview. Securing TCP/IP. Introduction to TCP/IP (cont d) Introduction to TCP/IP

Lecture 5: Network Attacks I. Course Admin

Advanced Computer Networks Project 2: File Transfer Application

Computer Networks. Data Link Layer

Stop And Wait. ACK received; transmit frame 2 CS 455 3

Networks: IP and TCP. Internet Protocol

Data Communications & Networks. Session 6 Main Theme Reliable Data Transfer. Dr. Jean-Claude Franchitti

8-bit Microcontroller. Application Note. AVR460: Embedded Web Server. Introduction. System Description

COMP 361 Computer Communications Networks. Fall Semester Midterm Examination

Mobile Communications Chapter 9: Mobile Transport Layer

IP Network Layer. Datagram ID FLAG Fragment Offset. IP Datagrams. IP Addresses. IP Addresses. CSCE 515: Computer Network Programming TCP/IP

Access Control: Firewalls (1)

Transport layer protocols for ad hoc networks

TCP/IP Networking for Wireless Systems. Integrated Communication Systems Group Ilmenau University of Technology

Transport Protocols and Distributed Applications

Data Networks Summer 2007 Homework #3

CMPE 150 Winter 2009

Communication Systems Transport Layer - Protocols

TCP and Wireless Networks Classical Approaches Optimizations TCP for 2.5G/3G Systems. Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme

Congestions and Control Mechanisms n Wired and Wireless Networks

Chapter 6 Congestion Control and Resource Allocation

TCP for Wireless Networks

First Midterm for ECE374 02/25/15 Solution!!

Midterm Exam CMPSCI 453: Computer Networks Fall 2011 Prof. Jim Kurose

How do I get to

A Survey on Congestion Control Mechanisms for Performance Improvement of TCP

Data Link Layer. Flow Control. Flow Control

Network Security: Workshop. Dr. Anat Bremler-Barr. Assignment #2 Analyze dump files Solution Taken from

TCP in Wireless Networks

Simulation-Based Comparisons of Solutions for TCP Packet Reordering in Wireless Network

Multipath TCP in Practice (Work in Progress) Mark Handley Damon Wischik Costin Raiciu Alan Ford

TOE2-IP FTP Server Demo Reference Design Manual Rev1.0 9-Jan-15

First Midterm for ECE374 03/24/11 Solution!!

The present and the future of TCP/IP

Improved Digital Media Delivery with Telestream HyperLaunch

Chapter 8 Security Pt 2

Lecture Objectives. Lecture 07 Mobile Networks: TCP in Wireless Networks. Agenda. TCP Flow Control. Flow Control Can Limit Throughput (1)

Application Level Congestion Control Enhancements in High BDP Networks. Anupama Sundaresan

A Distributed Approach to Collecting End-to-End Network Performance Measurements

Defending Computer Networks Lecture 6: TCP and Scanning. Stuart Staniford Adjunct Professor of Computer Science

Based on Computer Networking, 4 th Edition by Kurose and Ross

What is a DoS attack?

Lecture Computer Networks

Effect of Packet-Size over Network Performance

Host Fingerprinting and Firewalking With hping

Application Performance Analysis and Troubleshooting

On Inferring TCP Behavior

Digital Audio and Video Data

Improving Effective WAN Throughput for Large Data Flows By Peter Sevcik and Rebecca Wetzel November 2008

Homework 2 assignment for ECE374 Posted: 02/21/14 Due: 02/28/14

Command Manual - Network Protocol Quidway S3000 Series Ethernet Switches. Table of Contents

2.1 Introduction. 2.2 Voice over IP (VoIP)

Exercises TCP/IP Networking. Solution. With Solutions

Lecture 16: TCP/IP Vulnerabilities: IP Spoofing and Denial-of-Service Attacks. Lecture Notes on Computer and Network Security

Internet Protocols. Background CHAPTER

TCP Adaptation for MPI on Long-and-Fat Networks

IP - The Internet Protocol

Multiple Choice Questions

FILE TRANSFER PROTOCOL INTRODUCTION TO FTP, THE INTERNET'S STANDARD FILE TRANSFER PROTOCOL

Pig Laboratory. Additional documentation for the laboratory. Exercises and Rules. Tstat Data

Voice over IP. Demonstration 1: VoIP Protocols. Network Environment

The Fundamentals of Intrusion Prevention System Testing

Workshop on Network Traffic Capturing and Analysis IITG, DIT, CERT-In, C-DAC. Host based Analysis. {Himanshu Pareek,

Lecture 15: Congestion Control. CSE 123: Computer Networks Stefan Savage

A Transport Protocol for Multimedia Wireless Sensor Networks

Transcription:

TCP Kai Shen Dept. of Computer Science, University of Rochester 10/17/2007 CSC 257/457 - Fall 2007 1 TCP: Overview connection-oriented: handshaking (exchange of control msgs) to initialize sender, receiver state before data exchange pipelined: multiple in-flight segments full duplex data: bi-directional data flow in same connection reliable data transfer: guaranteed arrival, no error, in order flow controlled: sender does not overwhelm receiver congestion controlled: sender does not overwhelm the network no delay or bandwidth guarantee. 10/17/2007 CSC 257/457 - Fall 2007 2 TCP Segment Structure TCP Reliable Data Transfer URG: urgent data (generally not used) : # valid PSH: push data now (generally not used) RST, SYN, FIN: connection estab (setup, teardown commands) Internet checksum 32 bits source port # dest port # sequence number acknowledgement number head not UAP R S len used F Receive window checksum Urg data pnter Options (variable length) application data (variable length) counting by bytes of data (not segments!) # bytes rcvr willing to accept TCP provides reliable data transfer service on top of IP s unreliable service Pipelined transmissions Cumulative s When the receiver receives out-of-order segments, it buffers them and re-s the last in-order data Retransmit a single segment at each timeout The sender retransmits at timeout or receiving duplicate s Somewhere between Go-back-N and Selective Repeat, with some additional twists. 10/17/2007 CSC 257/457 - Fall 2007 3 10/17/2007 CSC 257/457 - Fall 2007 4

TCP Timeout Estimating Round Trip Time Q: principles for setting transmission timeout value? longer than normal RTT (round trip time) but RTT varies too short: premature timeout and unnecessary retransmissions too long: slow reaction to segment loss Q: how to estimate RTT? SampleRTT: measured time from segment transmission until receipt SampleRTT fluctuates, we want estimated RTT smoother to avoid instability (pre-mature reaction to short-term spikes) average several recent measurements, not just current SampleRTT we also want to give more recent measurements higher weight in case things do change 10/17/2007 CSC 257/457 - Fall 2007 5 10/17/2007 CSC 257/457 - Fall 2007 6 EWMA Exponentially Weighted Moving Average Example RTT Estimation RTT: gaia.cs.umass.edu to fantasia.eurecom.fr influence of past sample decreases exponentially fast 350 SampleRTT 1 + α*samplertt 2 + α 2 *SampleRTT 3 + EstimatedRTT = 1 + α + α 2 + 300 SampleRTT 1 SampleRTT 2 is RTT for the most recent data segment, is RTT for the next recent data segment, etc. RTT (milliseconds) 250 200 EstimatedRTT = α*estimatedrtt last + (1-α)*SampleRTT 1 150 typical value: α = 0.875 100 1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106 time (seconnds) 10/17/2007 CSC 257/457 - Fall 2007 7 SampleRTT Estimated RTT 10/17/2007 CSC 257/457 - Fall 2007 8

TCP Timeout TCP Sender Events and Processing Setting the timeout: EstimtedRTT plus safety margin large variation in EstimatedRTT larger safety margin we need to estimate of how much SampleRTT deviates from EstimatedRTT (EWMA): DevRTT = β*devrtt last (typically, β = 0.75) Then set timeout interval: + (1-β)* SampleRTT-EstimatedRTT TimeoutInterval = EstimatedRTT + 4*DevRTT 10/17/2007 CSC 257/457 - Fall 2007 9 Data ready to send: create segment with seq # seq # is byte-stream number of first data byte in segment start timer timeout value: we just decided it!! Timeout: retransmit segment that caused timeout restart timer rcvd: slide sender window if acknowledges previously unacked segments retransmit if 3 duplicate s 10/17/2007 CSC 257/457 - Fall 2007 10 TCP byte-oriented seq. # s and s TCP in Action: Cumulative Seq. # s: byte stream number of first byte in segment s data s: seq # of next byte expected from other side cumulative User types ls\n host s receipt of echoed vi a.c\n Host A Host B Seq=42, =79, data = ls\n Seq=79, =45, data = a.c\n Seq=45, =83 host s receipt of ls\n, echoes back a.c\n Slide sendwind base to 120 timeout Host A Host B Seq=92, 8 bytes data Seq=100, 20 bytes data X loss =120 =100 s piggybacked in data segments in the other direction simple telnet scenario 10/17/2007 CSC 257/457 - Fall 2007 11 time time Cumulative scenario 10/17/2007 CSC 257/457 - Fall 2007 12

Fast Retransmission TCP in Action: Duplicate s and Fast Retransmission Time-out period often relatively long: long delay before resending lost packet When receiver receives out-of-order segments, it re-s the last in-order byte If sender receives 3 s for the same data, it supposes that segment after ed data was lost: fast retransmission: resend segment before timer expires, restart timer 3 duplicate s resend 92 timeout Host A Host B =92 Seq=92, 8 bytes data X Seq=100, 8 bytes data Seq=108, 8 bytes data Seq=116, 8 bytes data =92 =92 =92 loss Seq=92, 8 bytes data time Cumulative scenario 10/17/2007 CSC 257/457 - Fall 2007 13 10/17/2007 CSC 257/457 - Fall 2007 14 Outline TCP Flow Control segment structure reliable data transfer flow control connection management receive side of TCP connection has a receive buffer: flow control sender does not overflow receiver s buffer by transmitting too much, too fast app process may be slow at reading from buffer speed-matching service: matching the send rate to the receiving app s drain rate 10/17/2007 CSC 257/457 - Fall 2007 15 10/17/2007 CSC 257/457 - Fall 2007 16

TCP Flow Control: how it works? TCP Connection Management Establishment: TCP sender, receiver establish connection before exchanging data segments initialize TCP variables: starting seq. #s, MSS, buffers, flow control info (e.g. RcvWindow) Rcvr advertises spare room by including value of RcvWindow in segments Sender limits uned data to RcvWindow guarantees receive buffer doesn t overflow MSS is the maximum TCP segment size each side is willing to accept typically the largest segment size fit into a link-layer frame Teardown: freeing up resources after mutually close 10/17/2007 CSC 257/457 - Fall 2007 17 10/17/2007 CSC 257/457 - Fall 2007 18 TCP Connection Establishment TCP Connection Teardown Three way handshake: Step 1: client (active open) sends TCP SYN segment to server specifies initial seq # no data Step 2: server (passive open) host receives SYN, replies with SYN segment server allocates buffers specifies server initial seq. # Step 3: client receives SYN, replies with segment, which may contain data connection request client server SYN, seq=x, no data SYN, seq=y, =x+1, no data seq=x+1, =y+1, maybe data 10/17/2007 CSC 257/457 - Fall 2007 19 Closing a connection: close socket: close(sockfd); Step 1: A (active closing host) sends TCP FIN control segment to server Step 2: B (passive closing host) receives FIN, replies with. Closes connection, sends FIN. Step 3: A receives FIN, replies with. close Enters timed wait resend in case it is lost closed Step 4: B receives. Connection closed. 10/17/2007 CSC 257/457 - Fall 2007 20 timed wait A FIN FIN B close

TCP State Transition Diagram CLOSED Active open/syn Passive open Close Close LISTEN SYN/SYN + Send/SYN SYN/SYN + SYN_RCVD SYN_SENT SYN + / Close/FIN ESTABLISHED Disclaimer Parts of the lecture slides contain original work of James Kurose, Larry Peterson, and Keith Ross. The slides are intended for the sole purpose of instruction of computer networks at the University of Rochester. All copyrighted materials belong to their original owner(s). FIN_WAIT_1 Close/FIN FIN/ + FIN/ FIN/ CLOSE_WAIT Close/FIN FIN_WAIT_2 FIN/ CLOSING TIME_WAIT Timeout after two segment lifetimes LAST_ CLOSED 10/17/2007 CSC 257/457 - Fall 2007 21 10/17/2007 CSC 257/457 - Fall 2007 22