Copyright (c) 2002 EventHelix.com Inc. All Rights Reserved.

Similar documents
This sequence diagram was generated with EventStudio System Designer (

Transport Layer Protocols

TCP in Wireless Mobile Networks

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

Computer Networks. Chapter 5 Transport Protocols

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

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

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

Chapter 5. Transport layer protocols

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

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

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

A Survey on Congestion Control Mechanisms for Performance Improvement of TCP

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

Data Networks Summer 2007 Homework #3

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

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

Final for ECE374 05/06/13 Solution!!

TCP over Wireless Networks

TCP Westwood for Wireless

[Prof. Rupesh G Vaishnav] Page 1

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

Advanced Computer Networks Project 2: File Transfer Application

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

2 TCP-like Design. Answer

Mobile Communications Chapter 9: Mobile Transport Layer

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

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

High Speed Internet Access Using Satellite-Based DVB Networks

TCP for Wireless Networks

Congestions and Control Mechanisms n Wired and Wireless Networks

Improved Digital Media Delivery with Telestream HyperLaunch

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

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

TCP in Wireless Networks

SJBIT, Bangalore, KARNATAKA

TCP Adaptation for MPI on Long-and-Fat Networks

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

A Transport Protocol for Multimedia Wireless Sensor Networks

Question: 3 When using Application Intelligence, Server Time may be defined as.

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

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

Access Control: Firewalls (1)

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

CS268 Exam Solutions. 1) End-to-End (20 pts)

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

Ethernet. Ethernet. Network Devices

A Survey: High Speed TCP Variants in Wireless Networks

Low-rate TCP-targeted Denial of Service Attack Defense

Visualizations and Correlations in Troubleshooting

Per-Flow Queuing Allot's Approach to Bandwidth Management

Mobile Computing/ Mobile Networks

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

VPN over Satellite A comparison of approaches by Richard McKinney and Russell Lambert

Solving complex performance problems in TCP/IP and SNA environments.

Ina Minei Reuven Cohen. The Technion. Haifa 32000, Israel. Abstract

Analytic Models for the Latency and Steady-State Throughput of TCP Tahoe, Reno and SACK

EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics and Computer Science

Expert Reference Series of White Papers. Troubleshooting Slow Networks with Wireshark

COMP 361 Computer Communications Networks. Fall Semester Midterm Examination

ECSE-6600: Internet Protocols Exam 2

(Refer Slide Time: 02:17)

Computer Networks UDP and TCP

How To Design A Layered Network In A Computer Network

An enhanced approach for transmission control protocol traffic management Mechanism for Wireless Network

This sequence diagram was generated with EventStudio System Designer (

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

A Qos SCHEME TO ADDRESS COMMUNICATION LATENCY ISSUES FOR CRITICAL NETWORK FLOWS IN BEST-EFFORT NETWORKS USING MOBILE AGENTS

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

An Improved TCP Congestion Control Algorithm for Wireless Networks

THE UNIVERSITY OF AUCKLAND

We will give some overview of firewalls. Figure 1 explains the position of a firewall. Figure 1: A Firewall

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

Lecture 2-ter. 2. A communication example Managing a HTTP v1.0 connection. G.Bianchi, G.Neglia, V.Mancuso

Linux 2.4 Implementation of Westwood+ TCP with rate-halving: A Performance Evaluation over the Internet

TTC New Reno - Consistent Control of Packet Traffic

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

Networking Test 4 Study Guide

The Problem with TCP. Overcoming TCP s Drawbacks

CSMA/CA. Information Networks p. 1

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

Sample Network Analysis Report

Transport Layer. Chapter 3.4. Think about

APPENDIX 1 USER LEVEL IMPLEMENTATION OF PPATPAN IN LINUX SYSTEM

Why SSL is better than IPsec for Fully Transparent Mobile Network Access

Computer Networks - CS132/EECS148 - Spring

Chapter 6 Congestion Control and Resource Allocation

Transport layer issues in ad hoc wireless networks Dmitrij Lagutin,

Exercises TCP/IP Networking. Solution. With Solutions

Ethernet-based Storage Configuration

How do I get to

An enhanced TCP mechanism Fast-TCP in IP networks with wireless links

HyperIP : VERITAS Replication Application Note

SELECTIVE-TCP FOR WIRED/WIRELESS NETWORKS

On Inferring TCP Behavior

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

Research of TCP ssthresh Dynamical Adjustment Algorithm Based on Available Bandwidth in Mixed Networks

Transport and Network Layer

Policy Based Forwarding

Homework 3 assignment for ECE374 Posted: 03/13/15 Due: 03/27/15

Transcription:

_ Interfaces (TCP Connection Setup and Release) Node Internet Node Net App App 14-Apr-02 20:19 (Page 1) Copyright (c) 2002 EventHelix.com Inc. All Rights Reserved. LEG: About TCP TCP (Transmission Control Protocol) provides a reliable end to end service that delivers packets over the Internet. Packets are delivered in sequence without loss or duplication. Application s a Application s The socket is d in the state seq_num = 0 Initial sequence number is set to 0 Active_Open Application wishes to communicate with a destination server using a TCP connection. The application opens a socket for the connection in active mode. In this mode, a TCP connection will be attempted with the server. Typically, the client will use a well known port number to communicate with the remote. For example, HTTP uses port 80. LEG: initiates TCP connection SYN src = _Port, dst = _Port, seq_num = _0 SYN Sent SYN_ src = _Port, dst = _Port, seq_num = _100, ack_num = _1, window = _65535 src = _Port, dst = _Port, ack_num = _101, window = _5000 Established initiated three way handshake to establish a TCP connection sets the SYN bit in the TCP header to request a TCP connection. The sequence number field is set to 0. Since the SYN bit is set, this sequence number is used as the initial sequence number transitions to the SYN Sent state receives the SYN_ TCP segment now acknowledges the first segment, thus completing the three way handshake. The receive window is set to 5000. Ack sequence number is set to 101, this means that the next expected sequence number is 101. At this point, the client assumes that the TCP connection has been established LEG: Short data transfer transfer phase: Here a short data transfer takes place, thus TCP slow start has little impact size = _1024 Split data into TCP segments seq_num = _1, len = _512 seq_num = _513, len = _512 ack_num = _1025 seq_num = _1, len = _512 seq_num = _613, len = _188 application sends 1024 bytes of data to the socket This TCP connection limits TCP segments to 512 bytes, thus the received data is split into 2 TCP segments The first TCP segment is sent with a sequence number of 1. This is the sequence number for the first byte in the segment. (Note that unlike other protocols, TCP maintains sequence numbers at byte level. The sequence number field in the TCP header corresponds to the first byte in the segment.) Bytes in the first TCP segment correspond to 1 to 512 sequence numbers. Thus, the second TCP segment contains data starting with 513 sequence number has received both the TCP segments

_ Interfaces (TCP Connection Setup and Release) Node Internet Node Net App Assemble TCP Segments size = _700 ack_num = _701 App 14-Apr-02 20:19 (Page 2) passes data to application sends a TCP with the next expected sequence number set to 701 LEG: initiates TCP connection close initiates TCP connection close Close Wait 1 Wait 2 Time Wait application wishes to release the TCP connection sends a TCP segment with the bit set in the TCP header changes state to Wait 1 state receives the changes state to Wait 2. In this state, the TCP connection from the client to server is closed. now waits close of TCP connection from the server end receives sends starts a timer to handle scenarios where the last ack has been lost and server resends waits in Time Wait state to handle a retry Close timer has expired. Thus the client end connection can be closed too.

_ Interfaces (TCP Slow Start) Node Internet Node Net App App 14-Apr-02 20:19 (Page 3) Copyright (c) 2002 EventHelix.com Inc. All Rights Reserved. LEG: About TCP Slow Start TCP is an end to end protocol which operates over the heterogeneous Internet. TCP has no advance knowledge of the network characteristics, thus it has to adjust its behavior according to the current state of the network. TCP has built in support for congestion control. Congestion control ensures that TCP does not pump data at a rate higher than what the network can handle. In this sequence diagram we will analyse "Slow start", an important part of the congestion control mechanisms built right into TCP. As the name suggests, "Slow Start" starts slowly, increasing its window size as it gains confidence about the networks throughput. Application s a Application s The socket is d in the state seq_num = 0 Initial sequence number is set to 0 Active_Open Application wishes to communicate with a destination server using a TCP connection. The application opens a socket for the connection in active mode. In this mode, a TCP connection will be attempted with the server. Typically, the client will use a well known port number to communicate with the remote. For example, HTTP uses port 80. LEG: initiates TCP connection SYN src = _Port, dst = _Port, seq_num = _0 SYN Sent SYN_ src = _Port, dst = _Port, seq_num = _100, ack_num = _1, window = _65535 src = _Port, dst = _Port, ack_num = _101, window = _5000 Established initiated three way handshake to establish a TCP connection sets the SYN bit in the TCP header to request a TCP connection. The sequence number field is set to 0. Since the SYN bit is set, this sequence number is used as the initial sequence number transitions to the SYN Sent state receives the SYN_ TCP segment now acknowledges the first segment, thus completing the three way handshake. The receive window is set to 5000. Ack sequence number is set to 101, this means that the next expected sequence number is 101. At this point, the client assumes that the TCP connection has been established LEG: TCP Slow Start A TCP connection starts in the "Slow Start" state. In this state, TCP adjusts its transmission rate based on the rate at which the acknowledgements are received from the other end. TCP Slow start is implemented using two variables, viz cwnd (Congestion Window)and ssthresh (Slow Start Threshold). cwnd is a self imposed transmit window restriction at the sender end. cwnd will increase as TCP gains more confidence on the networks ability to handle traffic. ssthresh is the threshold for determining the point at which TCP exits slow start. If cwnd increases beyond ssthresh, the TCP session in that direction is considered to be out of slow start phase cwnd = 512 (1 segment) ssthresh = 65535 maintains a congestion window (cwnd). Initially the window is set to lower of the maximum TCP segment size and receiver's allowed window size. In most cases the segment size is smaller than receiver window, thus cwnd is set to the maximum TCP segment size (512 in this example) Note here that cwnd implements a transmitter end flow control. The receiver advertised window implements a receiver enforced flow control. TCP connections start with ssthresh set to 64K. This variable will be used to determine the point at which TCP exits slow

_ Interfaces (TCP Slow Start) Node Internet Node Net App size = _5120 Slow Start App 14-Apr-02 20:19 (Page 4) start end TCP connection moves to slow start state application sends 5120 bytes of data to the socket Roundtrip #1 of data transmission seq_num = _1, len = _512 ack_num = _513 cwnd = 1024 (2 seq_num = _513, len = _512 seq_num = _1025, len = _512 ack_num = _1537 cwnd = 1536 (3 seq_num = _1537, len = _512 seq_num = _2049, len = _512 seq_num = _2561, len = _512 ack_num = _2561 cwnd = 2048 (4 ack_num = _3073 cwnd = 2560 (5 seq_num = _3073, len = _512 seq_num = _3585, len = _512 seq_num = _4097, len = _512 seq_num = _4609, len = _512 seq_num = _5121, len = _512 ack_num = _4097 cwnd = 3072 (6 The first TCP segment is sent with a sequence number of 1. This is the sequence number for the first byte in the segment. receives the acknowledgement for the first TCP data segment As the TCP session is in slow start, receipt of an acknowledgement increments the congestion window by one 1 segment. Roundtrip #2 of data transmission Since the congestion window has increased to 2, TCP can now send two segments without waiting for an ack Receipt for ack again moves the congestion window Roundtrip #3 of data transmission Now three segments can be sent without waiting for an ack The TCP acknowlegements again increment cwnd. This time two acks are received, so cwnd will get incremented by 2 Since cwnd has reached 5 segments, TCP is allowed to send 5 segments without waiting for the ack Roundtrip #4 of data transmission Three acknowledgements will be received for the 5 TCP segments. Now the cwnd has almost started increasing geometrically for every round trip between the client and the server.

_ Interfaces (TCP Slow Start) Node Internet Node Net App ack_num = _5121 cwnd = 3584 (7 ack_num = _5633 cwnd = 4096 (8 cwnd = 4608 (9 cwnd = 5120 (10 cwnd = 5630 (11 cwnd = 6144 (12 App Roundtrip #5 of data transmission 14-Apr-02 20:19 (Page 5) This time 8 TCP segments are sent Now four acks will be received, thus moving cwnd even more quickly Within a few more roundtrip interactions cwnd will exceed ssthresh. At this point the session will be considered out of slow start. Note that the TCP connection from the client side is out of slow start but the server end is still in slow start as it has not sent any data to the client. Exiting slow start signifies that the TCP connection has reached an equilibrium state where the congestion window closely matches the networks capacity. From this point on, the congestion window will not move geometrically. cwnd will move linearly once the connection is out of slow start. Close Congestion Avoidance Wait 1 Wait 2 Once slow start ends, the session enters congestion avoidance state. This will be discussed in a subsequent article. LEG: initiates TCP connection close initiates TCP connection close application wishes to release the TCP connection sends a TCP segment with the bit set in the TCP header changes state to Wait 1 state receives the changes state to Wait 2. In this state, the TCP connection from the client to server is closed. now waits close of TCP connection from the server end receives sends

_ Interfaces (TCP Slow Start) Node Internet Node Net App Time Wait App 14-Apr-02 20:19 (Page 6) starts a timer to handle scenarios where the last ack has been lost and server resends waits in Time Wait state to handle a retry Close timer has expired. Thus the client end connection can be closed too.

_ Interfaces (TCP Congestion Avoidance) Node Internet Node Net App App 14-Apr-02 20:19 (Page 7) Copyright (c) 2002 EventHelix.com Inc. All Rights Reserved. LEG: About TCP Congestion Avoidance We have already seen that TCP connection starts up in slow start mode, geometrically increasing the congestion window (cwnd) until it crosses the slow start threshold (ssthresh). Once cwnd is greater that ssthresh, TCP enters the congestion avoidance mode of operation. In this mode, the primary objective is to maintain high throughput without causing congestion. If TCP detects segment loss, it assumes that congestion has been detected over the internet. As a corrective action, TCP reduces its data flow rate by reducing cwnd. After reducing cwnd, TCP goes back to slow start. Application s a Application s The socket is d in the state seq_num = 0 Initial sequence number is set to 0 Active_Open Application wishes to communicate with a destination server using a TCP connection. The application opens a socket for the connection in active mode. In this mode, a TCP connection will be attempted with the server. Typically, the client will use a well known port number to communicate with the remote. For example, HTTP uses port 80. LEG: initiates TCP connection SYN src = _Port, dst = _Port, seq_num = _0 SYN Sent SYN_ src = _Port, dst = _Port, seq_num = _100, ack_num = _1, window = _65535 src = _Port, dst = _Port, ack_num = _101, window = _5000 Established cwnd = 512 bytes (1 segment) ssthresh = 65535 bytes initiated three way handshake to establish a TCP connection sets the SYN bit in the TCP header to request a TCP connection. The sequence number field is set to 0. Since the SYN bit is set, this sequence number is used as the initial sequence number transitions to the SYN Sent state receives the SYN_ TCP segment now acknowledges the first segment, thus completing the three way handshake. The receive window is set to 5000. Ack sequence number is set to 101, this means that the next expected sequence number is 101. At this point, the client assumes that the TCP connection has been established LEG: TCP Congestion Avoidance Operation TCP connection begins with a congestion window size of 1 segment The slow start threshold starts with 64 Kbytes as the threshold value. TCP session begins with "Slow Start". See the sequence diagram on slow start for details Slow Start Since cwnd < ssthresh, TCP state is slow start TCP congestion window grows from 512 bytes (1 segment) to 64947 (assuming no segment losses are detected during slow start). During slow start the congestion window was being incremented by 1 segment for every TCP Ack from the other end. seq_num = _100000, len = _512 seq_num = _100512, len = _512 Application sends data for transmission over the TCP is split into TCP Segments. The segments are sent over the Internet

_ Interfaces (TCP Congestion Avoidance) Node Internet Node Net App ack_num = _101024, window = _80000 cwnd = 64947 + 512 = 65459 Congestion Avoidance seq_num = _101024, len = _512 seq_num = _101536, len = _512 ack_num = _102048, window = _80000 App 14-Apr-02 20:19 (Page 8) Since TCP is in slow start, every ack leads to the window growing by one segment. At this point cwnd (=65459) > ssthresh (=65535) thus TCP changes state to congestion avoidance. Now TCP window growth will be much more conservative. If no segment or ack losses are detected, the congestion window will grow no more than one segment per roundtrip. (Compare this with geometric growth of 1 segment per TCP ack in slow start) More data is received from the client application data is split into TCP segments cwnd is incremented using the formula: cwnd = cwnd + (segment_size segment_size) / cwnd) cwnd = 65459 + [(512 * 512) / 65459] = 65459 + 4 = 65463 seq_num = _102048, len = _512 AckTimer AckTimer ssthresh = 65463/2 = 32731 cwnd = 512 bytes (1 segment) Slow Start seq_num = _102048, len = _512 ack_num = _102560 cwnd = 512 + 512 = 1024 size = _3072 Now TCP is in congestion avoidance mode, so the TCP window advances very slowly. Here the window increased by only 4 bytes. to be sent to server TCP session sends out the data as a single segment TCP session starts a ack timer, awaiting the TCP ack for this segment. Note: The above timer is started for every segment. The timer is not shown at other places as it played role in our analysis TCP times out for a TCP from the other end. This will be treated as a sign of congestion by TCP When TCP detects congestion, it stores half of the current congestion window in ssthresh variable. In this case, ssthresh has been reduced from 65535 to 32731. This signifies that TCP now has less confidence on the network's ability to support big window sizes. Thus if the window size falls due to congestion, rapid window size increases will be carried out only until the window reaches 32731. Once this lowered ssthresh value is reached, window growth will be much slower. Since current congestion has been detected by timeout, TCP takes the drastic action of reducing the congestion window to 1. As you can see, this will have a big impact on the throughput. cwnd (=1) is now lower than ssthresh (=32731) so TCP goes back to slow start. Since TCP is in slow start, a TCP acknowledgement results in the window growing by one segment TCP window continues to grow exponentially until it reaches the ssthresh (=32731) value.

_ Interfaces (TCP Congestion Avoidance) Node Internet Node Net App size = _512 size = _512 size = _512 size = _512 size = _512 size = _512 cwnd = 32730 + 512 = 33242 Congestion Avoidance cwnd = 33242 + (512*512)/33242 = 33242 + 8 = 33250 cwnd = 33250 + (512*512)/33250 = 33250 + 8 = 33258 App 14-Apr-02 20:19 (Page 9) Six TCP segments are transmitted in the slow start mode Ack for the first two segments is received TCP is in slow start so the congestion window is increased by one segment Now cwnd (=33242) > ssthresh (=32731), thus the TCP session moves into congestion avoidance Ack for the next two segments is received Now the TCP window is growing very slowly by approximately 8 bytes per ack Ack for the last two segments is received Congestion window continues to advance at a slow rate LEG: initiates TCP connection close initiates TCP connection close Close Wait 1 Wait 2 Time Wait application wishes to release the TCP connection sends a TCP segment with the bit set in the TCP header changes state to Wait 1 state receives the changes state to Wait 2. In this state, the TCP connection from the client to server is closed. now waits close of TCP connection from the server end receives sends starts a timer to handle scenarios where the last ack has been lost and server resends waits in Time Wait state to handle a retry Close timer has expired. Thus the client end connection can be closed too.

_ Interfaces (TCP Fast Retransmit and Fast Recovery) Node Internet Node Net App App 14-Apr-02 20:19 (Page 10) Copyright (c) 2002 EventHelix.com Inc. All Rights Reserved. LEG: About Fast Retransmit and Fast Recovery TCP Slow Start and Congestion Avoidance lower the data throughput drastically when segment loss is detected. Fast Retransmit and Fast Recovery have been designed to speed up the recovery of the connection, without compromising its congestion avoidance characteristics. Fast Retransmit and Recovery detect a segment loss via duplicate acknowledgements. When a segment is lost, TCP at the receiver will keep sending ack segments indicating the next expected sequence number. This sequence number would correspond to the lost segment. If only one segment is lost, TCP will keep generating acks for the following segments. This will result in the transmitter getting duplicate acks (i.e. acks with the same ack sequence number) Application s a Application s The socket is d in the state seq_num = 0 Initial sequence number is set to 0 Active_Open Application wishes to communicate with a destination server using a TCP connection. The application opens a socket for the connection in active mode. In this mode, a TCP connection will be attempted with the server. Typically, the client will use a well known port number to communicate with the remote. For example, HTTP uses port 80. LEG: initiates TCP connection SYN src = _Port, dst = _Port, seq_num = _0 SYN Sent SYN_ src = _Port, dst = _Port, seq_num = _100, ack_num = _1, window = _65535 src = _Port, dst = _Port, ack_num = _101, window = _5000 Established initiated three way handshake to establish a TCP connection sets the SYN bit in the TCP header to request a TCP connection. The sequence number field is set to 0. Since the SYN bit is set, this sequence number is used as the initial sequence number transitions to the SYN Sent state receives the SYN_ TCP segment now acknowledges the first segment, thus completing the three way handshake. The receive window is set to 5000. Ack sequence number is set to 101, this means that the next expected sequence number is 101. At this point, the client assumes that the TCP connection has been established LEG: Fast Retransmit and Recovery TCP Connection begins with slow start. The congestion window grows from an initial 512 bytes to 70000 bytes size = _4096 cwnd = 70000 Segment data into 8 TCP segments seq_num = _100000 seq_num = _100512 seq_num = _101024 seq_num = _101536 Congestion window has reached 70000 bytes App transmits 4Kbytes of data TCP segments data to 8 TCP segments (each segment is 512 bytes) TCP segment (start sequence number = 100000) is transmitted TCP segment (start sequence number = 100512) is transmitted TCP segment (start sequence number = 101024) is transmitted TCP segment (start sequence number = 101536) is transmitted

_ Interfaces (TCP Fast Retransmit and Fast Recovery) Node Internet Node Net App seq_num = _102048 seq_num = _102560 seq_num = _103072 seq_num = _103584 App 14-Apr-02 20:19 (Page 11) TCP segment (start sequence number = 102048) is transmitted TCP segment (start sequence number = 102560) is transmitted TCP segment (start sequence number = 103072) is transmitted TCP segment (start sequence number = 103584) is transmitted Fast Retransmit: TCP receives duplicate acks and it decides to retransmit the segment, without waiting for the segment timer to expire. This speeds up recovery of the lost segment ack_num = _100512 ack_num = _100512 Fast Retransmit ack_num = _100512 ack_num = _100512 ssthresh = cwnd/2 = 70000/2 = 35000 seq_num = _100512 receives acknowledgement to the segment with starting sequence number 100512 First duplicate ack is received. TCP does not know if this ack has been duplicated due to out of sequence delivery of segments or the duplicate ack is caused by lost segment. At this point TCP moves to the fast retransmit state. TCP will look for duplicate acks to decide if a segment needs to be retransmitted Note: TCP segments sent by the sender can be delivered out of sequence to the receiver. This can also result in duplicate acks. Thus TCP waits for 3 duplicate acks before concluding that a segment has been missed. Second duplicate ack is received Third duplicate ack is received. TCP now assumes that duplicate acks point to a segment that has been lost TCP uses the current congestion window to mark the point of congestion. It saves the slow start threshold as half of the current congestion window size. If current cwnd is less than 4 segments, cwnd is set to 2 segments TCP retransmits the missing segment i.e. the segment corresponding to the ack sequence number in the duplicate acks Fast Recovery: Once the lost segment has been transmitted, TCP tries to maintain the current data flow by not going back to slow start. TCP also adjusts the window for all segments that have been buffered by the receiver. Fast Recovery cwnd = ssthresh + 3 segments = 35000 + 3*512 = 36536 ack_num = _100512 cwnd = cwnd + 1 segment = 37048 ack_num = _100512 cwnd = cwnd + 1 segment = 37560 ack_num = _104096 Congestion Avoidance cwnd = ssthresh = 35000 In "Fast Recovery" state, TCPs main objective is to maintain the current data stream data flow. Since TCP started taking action on the third duplicate ack, it sets the congestion window to ssthresh + 3 segment. This halfs the TCP window size and compensates for the TCP segments that have already been buffered by the receiver. Another duplicate ack is received. This means that the receiver has buffered one more segment TCP again inflates the congestion window to compensate for the delivered segment Yet another ack is received, this will further inflate the congestion window The cummulative TCP ack is delivered to the client Congestion Avoidance The connection has moved back to the congestion avoidance state. TCP takes a congestion avoidance action and sets the segment size back to the slow start threshold. The TCP window will now increase by a maximum of one segment per round trip

_ Interfaces (TCP Fast Retransmit and Fast Recovery) Node Internet Node Net App App 14-Apr-02 20:19 (Page 12) LEG: initiates TCP connection close initiates TCP connection close Close Wait 1 Wait 2 Time Wait application wishes to release the TCP connection sends a TCP segment with the bit set in the TCP header changes state to Wait 1 state receives the changes state to Wait 2. In this state, the TCP connection from the client to server is closed. now waits close of TCP connection from the server end receives sends starts a timer to handle scenarios where the last ack has been lost and server resends waits in Time Wait state to handle a retry Close timer has expired. Thus the client end connection can be closed too.