SlideShare une entreprise Scribd logo
1  sur  35
Transmission Control
Protocol
Agenda

Introduction
 Features
 Connection Establishment and Termination
 Flow Control
 Error Control
 Congestion Control


2 of 35
TCP Introduction


TCP:



TCP seeks to deliver a byte stream from end-toend, in order, reliably.

◦
◦
◦
◦
◦
◦
◦

Process-to-Process communication
Full Duplex communication
Connection-oriented service
Stream-oriented protocol (stream of bytes)
Segmentation (datagrams in IP layer)
Utilizes buffers at both ends (flow & error control)
Reliable (ACKs)

3 of 35
TCP Header

4 of 35
TCP Features


Numbering system
◦ Byte Number
 TCP numbers all the data bytes that are transmitted in a
connection
 Numbering does not necessarily start from 0
 TCP generates a random number between 0 and 232-1 for
numbering first byte
 Eg. Random no. = 3423 (first byte)
 Total bytes = 5000
 Numbering range = 3423-8422
5 of 35
TCP Features
◦ Sequence number
 Bytes are grouped into “segments”
 Sequence number for each segment is the number of
the first byte carried in that segment
 3423 (3423-4422)
 4423 (4423-5422)
 5423 (5423-6422)
 6423 (6423-7422)
 7423 (7423-8422)
6 of 35
TCP Features
◦ Acknowledgement number
 Defines the number of the next byte that the
party expects to receive
 It is cumulative
 ACK = 5487
 It means it has received all bytes from beginning
up to 5486 (beginning may not be 0)

7 of 35
TCP Features


Flow control
◦ Receiver of the data controls the amount of data that are
to be sent by the sender
◦ Numbering system allows TCP to use byte-oriented flow
control



Error control
◦ Considers a segment as a unit of data for error detection



Congestion control
8 of 35
Connection Establishment



Establishes a virtual path between the source
and destination
How TCP is connection-oriented while using IP
(connection-less)?
◦ Connection is virtual
◦ TCP uses the services of IP to deliver individual
segments, but it controls the connection itself
◦ IP is unaware of retransmission, out-of-order segments

9 of 35
Connection Establishment


Three way Handshaking

10 of 35
Connection Establishment


SYN:



SYN+ACK:



ACK

◦ It is for synchronization of sequence numbers
◦ It consumes 1 sequence number
◦ Carries no real data
◦ SYN segment for communication in other direction and
ACK for the received SYN
◦ It consumes 1 sequence number
◦ Just an ACK segment
◦ Does not consume any sequence number
11 of 35
Connection Termination


Three way Handshaking

12 of 35
Connection Termination


FIN:
◦ It consumes 1 sequence number
◦ May or may not carry real data



FIN+ACK:
◦ FIN segment to announce closing of connection in other
direction and ACK for the received FIN
◦ It consumes 1 sequence number



ACK
◦ Just an ACK segment
◦ Does not consume any sequence number
13 of 35
14 of 35
Flow Control
TCP uses sliding window to handle flow control
 The size of the window is determined by the
lesser of two values: rwnd or cwnd
 rwnd: it is the number of bytes the receiver can
accept before its buffer overflows
 cwnd: it is the value determined by the network
to avoid congestion
 The receiver controls most of the aspects


15 of 35
Flow Control

16 of 35
Error Control




Includes mechanisms for detecting corrupted
segments, lost segments, out-of-order segments
and duplicated segments
Achieved through the use of three simple tools:
◦ Checksum
◦ Acknowledgement
◦ Retransmission

17 of 35
Checksum




Each segment includes a checksum field, used to
check for corrupted segment
TCP uses a 16-bit checksum
Corrupted segment is discarded by the
destination and is considered lost

18 of 35
Acknowledgement





Confirm the receipt of data segments
Control segments that carry no data but
consume
a
sequence
number
are
also
acknowledged
ACK segments are never acknowledged

19 of 35


Retransmission
A segment is retransmitted on two occasions:
◦ When a retransmission timer expires
◦ When the sender receives three duplicate ACKs




There is no retransmission for ACK segments
Retransmission after RTO:
◦ TCP maintains one RTO timer for all outstanding (sent,
but not acknowledged) segments
◦ When the timer matures, the earliest outstanding
segment is retransmitted
◦ Value of RTO is dynamic and is updated based on RTT
20 of 35
Fast Retransmission
Let the value of RTO be very large
 One segment is lost and receiver receives so
many out-of-order segments that they cannot be
saved (buffer size)
 When the sender receives 4 ACKs with same
value (1 original and 3 duplicates), even though
the
timer
has
not
matured
the
fast
retransmission requires that the segment be
resent immediately


21 of 35
Fast Retransmission

22 of 35
Fast Retransmission


When the sender receives retransmitted ACK, it
knows that the four segments are safe and
sound because ACK is cumulative

23 of 35
Adaptive Retransmission








TCP attempts to determine the approximate round-trip
time between the devices, and adjusts it over time to
compensate for increases or decreases in the average
delay.
TCP aims for an average RTT value for the connection.
This average should respond to consistent movement up or
down in the RTT without overreacting to a few very slow or
fast acknowledgments.
TCP re-estimates RTT after every successful transmission
(not retransmission).
24 of 35
Adaptive Retransmission


The RTT calculation uses a smoothing formula:
◦ New RTT = (a * Old RTT) + ( (1-a) * Newest RTT
Measurement)




Where “a” (alpha) is a smoothing factor between
0 and 1.
Higher values of “a" (closer to 1) provide better
smoothing and avoiding sudden changes as a
result of one very fast or very slow RTT
measurement
25 of 35
Adaptive Retransmission
Conversely, this also slows down how quickly TCP
reacts to more sustained changes in round-trip time.
 Lower values of alpha (closer to 0) make the RTT
change more quickly in reaction to changes in
measured RTT, but can cause “over-reaction” when
RTTs fluctuate wildly.
 Adaptive retransmission is a key for TCP success
since it allows TCP to run in fast networks as well as
slow networks.


26 of 35
Congestion Control


TCP’s general policy for handling congestion is
based on three phases:
◦ Slow Start: Exponential Increase
◦ Congestion Avoidance: Additive Increase
◦ Congestion Detection: Multiplicative Decrease

27 of 35
Slow Start


Size of congestion window (cwnd) starts with 1 max.
segment
size
(MSS),
determined
during
conn.
establishment

28 of 35
Slow Start
Slow start cannot continue indefinitely
 Sender keeps a track of a variable named
ssthresh, when the size of window, in bytes,
reaches this threshold, slow start stops
 In most cases the value of ssthresh is 65,535
bytes


29 of 35
Congestion Avoidance



When the slow start phase stops, the additive
phase begins
Each time the whole window of segments is
acknowledged, the size of the congestion window
is increased by 1

30 of 35
Congestion Detection
If congestion occurs, the congestion window size
must be decreased
 Sender can guess congestion by need to
retransmit a segment
 Retransmission can occur in one of two cases:


◦ Time-out
◦ 3 ACKs are received

31 of 35
Congestion Detection


If detection is by time-out:
◦ It sets the value of the threshold to one half of current
window size
◦ It sets cwnd to the size of one segment
◦ It starts the slow-start phase again



If detection is by 3 ACKs:
◦ It sets the value of the threshold to one half of current
window size
◦ It sets cwnd to the value of the threshold
◦ It starts the congestion avoidance phase
32 of 35
Congestion Example

33 of 35
34 of 35
Thank You

35 of 35

Contenu connexe

Tendances

Internet control message protocol
Internet control message protocolInternet control message protocol
Internet control message protocol
asimnawaz54
 
TCP/IP Network ppt
TCP/IP Network pptTCP/IP Network ppt
TCP/IP Network ppt
extraganesh
 

Tendances (20)

Internet control message protocol
Internet control message protocolInternet control message protocol
Internet control message protocol
 
Protocols and the TCP/IP Protocol Suite
Protocols and the TCP/IP Protocol SuiteProtocols and the TCP/IP Protocol Suite
Protocols and the TCP/IP Protocol Suite
 
What Is User Datagram Protocol?
What Is User Datagram Protocol?What Is User Datagram Protocol?
What Is User Datagram Protocol?
 
Transport layer protocol
Transport layer protocolTransport layer protocol
Transport layer protocol
 
Application Layer
Application Layer Application Layer
Application Layer
 
IEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and ServicesIEEE 802.11 Architecture and Services
IEEE 802.11 Architecture and Services
 
Transport layer protocols : TCP and UDP
Transport layer protocols  : TCP and UDPTransport layer protocols  : TCP and UDP
Transport layer protocols : TCP and UDP
 
Quality of Service
Quality of ServiceQuality of Service
Quality of Service
 
TCP/ IP
TCP/ IP TCP/ IP
TCP/ IP
 
data-link layer protocols
data-link layer protocols  data-link layer protocols
data-link layer protocols
 
Tcp IP Model
Tcp IP ModelTcp IP Model
Tcp IP Model
 
TCP/IP Network ppt
TCP/IP Network pptTCP/IP Network ppt
TCP/IP Network ppt
 
02 protocol architecture
02 protocol architecture02 protocol architecture
02 protocol architecture
 
UDP - User Datagram Protocol
UDP - User Datagram ProtocolUDP - User Datagram Protocol
UDP - User Datagram Protocol
 
Osi model
Osi modelOsi model
Osi model
 
Application layer
Application layerApplication layer
Application layer
 
Circuit Switching
Circuit SwitchingCircuit Switching
Circuit Switching
 
Token bus
Token busToken bus
Token bus
 
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
TCP & UDP ( Transmission Control Protocol and User Datagram Protocol)
 
Media Access Control
Media Access ControlMedia Access Control
Media Access Control
 

En vedette

Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12
koolkampus
 
Object Oriented Process basics
Object Oriented Process basicsObject Oriented Process basics
Object Oriented Process basics
Oleg Yaroshevych
 

En vedette (12)

TCP - Transmission Control Protocol
TCP - Transmission Control ProtocolTCP - Transmission Control Protocol
TCP - Transmission Control Protocol
 
TCP- Transmission Control Protocol
TCP-  Transmission Control Protocol TCP-  Transmission Control Protocol
TCP- Transmission Control Protocol
 
world wide web
world wide webworld wide web
world wide web
 
File Transfer Protocol
File Transfer ProtocolFile Transfer Protocol
File Transfer Protocol
 
FTP - File Transfer Protocol
FTP - File Transfer ProtocolFTP - File Transfer Protocol
FTP - File Transfer Protocol
 
Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12
 
Object Oriented Process basics
Object Oriented Process basicsObject Oriented Process basics
Object Oriented Process basics
 
File Transfer Protocol
File Transfer ProtocolFile Transfer Protocol
File Transfer Protocol
 
TCP Model
TCP ModelTCP Model
TCP Model
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
Tcp and udp
Tcp and udpTcp and udp
Tcp and udp
 
TCP/IP Basics
TCP/IP BasicsTCP/IP Basics
TCP/IP Basics
 

Similaire à Transmission Control Protocol (TCP)

Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................
SwatiHans10
 
transport layer protocols
transport layer protocolstransport layer protocols
transport layer protocols
BE Smârt
 

Similaire à Transmission Control Protocol (TCP) (20)

Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................
 
Transport Layer in Computer Networks (TCP / UDP / SCTP)
Transport Layer in Computer Networks (TCP / UDP / SCTP)Transport Layer in Computer Networks (TCP / UDP / SCTP)
Transport Layer in Computer Networks (TCP / UDP / SCTP)
 
tcp congestion .pptx
tcp congestion .pptxtcp congestion .pptx
tcp congestion .pptx
 
6610-l14.pptx
6610-l14.pptx6610-l14.pptx
6610-l14.pptx
 
04 MK-PPT End-to-End Protocols.ppt
04 MK-PPT End-to-End Protocols.ppt04 MK-PPT End-to-End Protocols.ppt
04 MK-PPT End-to-End Protocols.ppt
 
Transmission control protocol
Transmission control protocolTransmission control protocol
Transmission control protocol
 
Transport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptxTransport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptx
 
Introduction to TCP
Introduction to TCPIntroduction to TCP
Introduction to TCP
 
DCN 5th ed. slides ch24 Transport-Layer Protocols.pdf
DCN 5th ed. slides ch24 Transport-Layer Protocols.pdfDCN 5th ed. slides ch24 Transport-Layer Protocols.pdf
DCN 5th ed. slides ch24 Transport-Layer Protocols.pdf
 
transport layer protocols
transport layer protocolstransport layer protocols
transport layer protocols
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion Avoidance
 
TCP/IP
TCP/IPTCP/IP
TCP/IP
 
tcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptxtcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptx
 
Networking essentials lect3
Networking essentials lect3Networking essentials lect3
Networking essentials lect3
 
TCP - IP Presentation
TCP - IP PresentationTCP - IP Presentation
TCP - IP Presentation
 
Tcp ip presentation
Tcp ip presentationTcp ip presentation
Tcp ip presentation
 
TCP protocol flow control
TCP protocol flow control TCP protocol flow control
TCP protocol flow control
 
Unit 5.Transport Layer.pptx
Unit 5.Transport Layer.pptxUnit 5.Transport Layer.pptx
Unit 5.Transport Layer.pptx
 
Congestion control in tcp
Congestion control in tcpCongestion control in tcp
Congestion control in tcp
 
Tcp congestion avoidance
Tcp congestion avoidanceTcp congestion avoidance
Tcp congestion avoidance
 

Plus de k33a (7)

Audit Principles
Audit PrinciplesAudit Principles
Audit Principles
 
An Overview of Consumer Privacy Regulations for TSPs in India
An Overview of Consumer Privacy Regulations for TSPs in IndiaAn Overview of Consumer Privacy Regulations for TSPs in India
An Overview of Consumer Privacy Regulations for TSPs in India
 
Security Information and Event Management (SIEM)
Security Information and Event Management (SIEM)Security Information and Event Management (SIEM)
Security Information and Event Management (SIEM)
 
Trusted Platform Module (TPM)
Trusted Platform Module (TPM)Trusted Platform Module (TPM)
Trusted Platform Module (TPM)
 
Bring Your Own Device (BYOD)
Bring Your Own Device (BYOD)Bring Your Own Device (BYOD)
Bring Your Own Device (BYOD)
 
Unified Extensible Firmware Interface (UEFI)
Unified Extensible Firmware Interface (UEFI)Unified Extensible Firmware Interface (UEFI)
Unified Extensible Firmware Interface (UEFI)
 
The Communist Manifesto
The Communist ManifestoThe Communist Manifesto
The Communist Manifesto
 

Dernier

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Dernier (20)

Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 

Transmission Control Protocol (TCP)

  • 2. Agenda Introduction  Features  Connection Establishment and Termination  Flow Control  Error Control  Congestion Control  2 of 35
  • 3. TCP Introduction  TCP:  TCP seeks to deliver a byte stream from end-toend, in order, reliably. ◦ ◦ ◦ ◦ ◦ ◦ ◦ Process-to-Process communication Full Duplex communication Connection-oriented service Stream-oriented protocol (stream of bytes) Segmentation (datagrams in IP layer) Utilizes buffers at both ends (flow & error control) Reliable (ACKs) 3 of 35
  • 5. TCP Features  Numbering system ◦ Byte Number  TCP numbers all the data bytes that are transmitted in a connection  Numbering does not necessarily start from 0  TCP generates a random number between 0 and 232-1 for numbering first byte  Eg. Random no. = 3423 (first byte)  Total bytes = 5000  Numbering range = 3423-8422 5 of 35
  • 6. TCP Features ◦ Sequence number  Bytes are grouped into “segments”  Sequence number for each segment is the number of the first byte carried in that segment  3423 (3423-4422)  4423 (4423-5422)  5423 (5423-6422)  6423 (6423-7422)  7423 (7423-8422) 6 of 35
  • 7. TCP Features ◦ Acknowledgement number  Defines the number of the next byte that the party expects to receive  It is cumulative  ACK = 5487  It means it has received all bytes from beginning up to 5486 (beginning may not be 0) 7 of 35
  • 8. TCP Features  Flow control ◦ Receiver of the data controls the amount of data that are to be sent by the sender ◦ Numbering system allows TCP to use byte-oriented flow control  Error control ◦ Considers a segment as a unit of data for error detection  Congestion control 8 of 35
  • 9. Connection Establishment   Establishes a virtual path between the source and destination How TCP is connection-oriented while using IP (connection-less)? ◦ Connection is virtual ◦ TCP uses the services of IP to deliver individual segments, but it controls the connection itself ◦ IP is unaware of retransmission, out-of-order segments 9 of 35
  • 11. Connection Establishment  SYN:  SYN+ACK:  ACK ◦ It is for synchronization of sequence numbers ◦ It consumes 1 sequence number ◦ Carries no real data ◦ SYN segment for communication in other direction and ACK for the received SYN ◦ It consumes 1 sequence number ◦ Just an ACK segment ◦ Does not consume any sequence number 11 of 35
  • 12. Connection Termination  Three way Handshaking 12 of 35
  • 13. Connection Termination  FIN: ◦ It consumes 1 sequence number ◦ May or may not carry real data  FIN+ACK: ◦ FIN segment to announce closing of connection in other direction and ACK for the received FIN ◦ It consumes 1 sequence number  ACK ◦ Just an ACK segment ◦ Does not consume any sequence number 13 of 35
  • 15. Flow Control TCP uses sliding window to handle flow control  The size of the window is determined by the lesser of two values: rwnd or cwnd  rwnd: it is the number of bytes the receiver can accept before its buffer overflows  cwnd: it is the value determined by the network to avoid congestion  The receiver controls most of the aspects  15 of 35
  • 17. Error Control   Includes mechanisms for detecting corrupted segments, lost segments, out-of-order segments and duplicated segments Achieved through the use of three simple tools: ◦ Checksum ◦ Acknowledgement ◦ Retransmission 17 of 35
  • 18. Checksum    Each segment includes a checksum field, used to check for corrupted segment TCP uses a 16-bit checksum Corrupted segment is discarded by the destination and is considered lost 18 of 35
  • 19. Acknowledgement    Confirm the receipt of data segments Control segments that carry no data but consume a sequence number are also acknowledged ACK segments are never acknowledged 19 of 35
  • 20.  Retransmission A segment is retransmitted on two occasions: ◦ When a retransmission timer expires ◦ When the sender receives three duplicate ACKs   There is no retransmission for ACK segments Retransmission after RTO: ◦ TCP maintains one RTO timer for all outstanding (sent, but not acknowledged) segments ◦ When the timer matures, the earliest outstanding segment is retransmitted ◦ Value of RTO is dynamic and is updated based on RTT 20 of 35
  • 21. Fast Retransmission Let the value of RTO be very large  One segment is lost and receiver receives so many out-of-order segments that they cannot be saved (buffer size)  When the sender receives 4 ACKs with same value (1 original and 3 duplicates), even though the timer has not matured the fast retransmission requires that the segment be resent immediately  21 of 35
  • 23. Fast Retransmission  When the sender receives retransmitted ACK, it knows that the four segments are safe and sound because ACK is cumulative 23 of 35
  • 24. Adaptive Retransmission     TCP attempts to determine the approximate round-trip time between the devices, and adjusts it over time to compensate for increases or decreases in the average delay. TCP aims for an average RTT value for the connection. This average should respond to consistent movement up or down in the RTT without overreacting to a few very slow or fast acknowledgments. TCP re-estimates RTT after every successful transmission (not retransmission). 24 of 35
  • 25. Adaptive Retransmission  The RTT calculation uses a smoothing formula: ◦ New RTT = (a * Old RTT) + ( (1-a) * Newest RTT Measurement)   Where “a” (alpha) is a smoothing factor between 0 and 1. Higher values of “a" (closer to 1) provide better smoothing and avoiding sudden changes as a result of one very fast or very slow RTT measurement 25 of 35
  • 26. Adaptive Retransmission Conversely, this also slows down how quickly TCP reacts to more sustained changes in round-trip time.  Lower values of alpha (closer to 0) make the RTT change more quickly in reaction to changes in measured RTT, but can cause “over-reaction” when RTTs fluctuate wildly.  Adaptive retransmission is a key for TCP success since it allows TCP to run in fast networks as well as slow networks.  26 of 35
  • 27. Congestion Control  TCP’s general policy for handling congestion is based on three phases: ◦ Slow Start: Exponential Increase ◦ Congestion Avoidance: Additive Increase ◦ Congestion Detection: Multiplicative Decrease 27 of 35
  • 28. Slow Start  Size of congestion window (cwnd) starts with 1 max. segment size (MSS), determined during conn. establishment 28 of 35
  • 29. Slow Start Slow start cannot continue indefinitely  Sender keeps a track of a variable named ssthresh, when the size of window, in bytes, reaches this threshold, slow start stops  In most cases the value of ssthresh is 65,535 bytes  29 of 35
  • 30. Congestion Avoidance   When the slow start phase stops, the additive phase begins Each time the whole window of segments is acknowledged, the size of the congestion window is increased by 1 30 of 35
  • 31. Congestion Detection If congestion occurs, the congestion window size must be decreased  Sender can guess congestion by need to retransmit a segment  Retransmission can occur in one of two cases:  ◦ Time-out ◦ 3 ACKs are received 31 of 35
  • 32. Congestion Detection  If detection is by time-out: ◦ It sets the value of the threshold to one half of current window size ◦ It sets cwnd to the size of one segment ◦ It starts the slow-start phase again  If detection is by 3 ACKs: ◦ It sets the value of the threshold to one half of current window size ◦ It sets cwnd to the value of the threshold ◦ It starts the congestion avoidance phase 32 of 35