SlideShare uma empresa Scribd logo
1 de 38
Baixar para ler offline
Transmission Control
Protocol (TCP)
T S Pradeep Kumar
VIT Chennai
http://www.nsnam.com
TCP Introduction
• Process to Process communication like UDP
• Stream Delivery service (Stream of Packets)
• Uses buffers at sending and receiving
• Segments
• Full Duplex
• Connection Oriented
• Reliable
TCP
TCP with Pseudo Headers
Control Field - TCP
Connection Establishment
• Three Way handshaking
• passive open, active open
• Data Transfer
• Connection Termination
• Connection Reset
• deny (, abort (abnormal, use RST) , terminate (idle for
long time, Use RST)
TCP
• A SYN segment cannot carry data, but consumes one
sequence number
• A SYN +ACK segment cannot carry data, but
consumes one sequence number.
• An ACK segment, if carrying no data, consumes no
sequence number.
Three way handshaking
Data Transfer
Connection Termination
Windows in TCP
• send window
• receive window
Send window
Window in TCP
• rwnd = buffer size - number of waiting bytes to be
pulled
• send window will open, close and shrink
• receive window will never shrink
Flow Control
• Opening and closing of windows
• Send window
• closes if the receiver tells (when ack comes)
• opens move the right wall to right (based on rwnd)
• on some occasions it shrinks
• receive window
• closes (left wall moves to right) when more bytes arrive
• opens (right wall moves to right) when bytes consumed by process
Flow control
Error Control
• error control for
• detecting and resending corrupted segments
• resending lost segments
• storing out of order segments
• detecting and discarding duplicated segments.
• Error control achieved by
• checksum
• acknowledgement
• Time out
Checksum
• Each segment carries a checksum value.
• If a segment is corrupted as deleted by an invalid
checksum, the segment is discarded and considered
as lost.
Acknowledgement
• Control and data segments consumes a sequence
number, so they will be acknowledged
• but ACK segments do not consume sequence
numbers and they are not acknowledged
• Types of acknowledgement
• cumulative (ACK)
• selective (SACK)
Acknowledgement
• Cumulative (ACK)
• sends the ack with a segment to be received
• ignoring all the out of order or lost segments
• Selective ack (SACK)
• cumulative ack + additional information to the sender
• reports the block of data that are out of order, duplicated
segments.
• usually this is implemented in the options field of the TCP headers.
ACK
• Retransmission of segments
• The segments are stored until the ACK is sent
• a segment is retransmited
• if three duplicate ACKs are received for the first segment
• retransmission timer expires
• Out of Order Segments
• they are never discarded but stored temporarily until the missing
segments arrive
• but they are never delivered to the process
Fast retransmit
Receive window
Congestion Control
• There are two windows
• rwnd (receiver window)
• cwnd (congestion window)
• congestion window is the window in the network
• Sender window = minimum (rwnd, cwnd)
• sender will reduce the window size based on the
receiver and network window size.
Congestion Control
• Slow start
• exponential increase till the threshold is reached
• then congestion avoidance, if congestion is
detected, goes back to slow start or congestion
avoidance
• Congestion avoidance
• congestion detection
Slow Start Threshold
• Starts the congestion window size with Maximum Segment Size
(1)
• Increase exponentially, for each ACK, the cwnd is increased by 1.
• When it reaches the threshold, the phase changes to congestion
avoidance (additive increase of cwnd).
• If multiple segments are acknowledge accumulatively, the MSS
increases to 1 and not 3. But still the growth is exponential, but
not in powers of 2
Slow Start Threshold
Congestion Avoidance
• Additive increase of window size
• when whole window of segments, the size of the
congestion is increase by one
• This phase will go on until congestion is detected.
• Once congestion is detected, the system goes back to
ssthrehold or congestion avoidance based on the
severity of the congestion.
congestion avoidance
Congestion Detection
• Multiplicative Decrease
• Sender understands the congestion, only when there
is a need to retransmit a segment
• RTO timer expires (Severe congestion)
• Three duplicate ACKs (Mild congestion)
Congestion detection
• If a time-out occurs, there is a stronger possibility of
congestion; a segment has probably been dropped in
the network and there is no news about the following
sent segments. In this case TCP reacts strongly:
• It sets the value of the threshold to half of the
current window size.
• It reduces cwnd back to one segment
• It starts the slow start phase again.
Congestion Detection
• If three duplicate ACKs are received, there is a weaker possibility
of congestion; a segment may have been dropped but some
segments after that have arrived safely since three duplicate
ACKs are received. This is called fast transmission and fast
recovery. In this case, TCP has a weaker reaction as shown
below:
• It sets the value of the threshold to half of the current window
size.
• It sets cwnd to the value of the threshold (some
implementations add three segment sizes to the threshold).
• It starts the congestion avoidance phase.
Congestion control policy
Tcp Timers
• Timers
• Retransmission
• Persistence
• Keepalive
• TIME WAIT
Retransmission Timers
• To retransmit lost segments, TCP employs one retransmission timer (for
the whole connection period) that handles the retransmission time-out
(RTO), the waiting time for a acknowledgment of a segment.
• When TCP sends the segment in front of the sending queue, it starts
the timer.
• When the timer expires, TCP resends the first segment in front of the
queue, and restarts the timer.
• When a segment (or segments) are cumulatively acknowledged, the
segment (or segments) are purged from the queue.
• If the queue is empty, TCP stops the timer; otherwise, TCP restarts the
timer.
Persistence Timer
• This timer is started when a size zero window is received by
the sender.
• Once a size zero window received, persistence timer is
started and the sending node sends a special segment
called a probe (1byte data which consumes a sequence
number but this probe will never be acknowledged)
• The probe causes the receiving TCP to resend the
acknowledgment.
• This process will go on until the non zero window size is
received by the sender.
Keepalive Timer
• This timer is to prevent a long idle connection between two TCPs
• If a client is crashed after it opens a Tcp connection, the connection is
open forever.
• So a server is running with a keepalive timer
• Each time the server hears from a client, it resets this timer.
• The time-out is usually 2 hours.
• If the server does not hear from the client after 2 hours, it sends a
probe segment. If there is no response after 10 probes, each of which
is 75 s apart, it assumes that the client is down and terminates the
connection.
TIME WAIT Timer
• Timer is used during connection termination
• When the FIN segment is received, the client sends an
ACK segment and goes to the TIME-WAIT state and
sets a timer for a time-out value of twice the maximum
segment lifetime (MSL).

Mais conteúdo relacionado

Mais procurados

Mobile Ad hoc Networks
Mobile Ad hoc NetworksMobile Ad hoc Networks
Mobile Ad hoc Networks
Jagdeep Singh
 

Mais procurados (20)

Multicastingand multicast routing protocols
Multicastingand multicast routing protocolsMulticastingand multicast routing protocols
Multicastingand multicast routing protocols
 
Network traffic analysis course
Network traffic analysis courseNetwork traffic analysis course
Network traffic analysis course
 
The Network Layer
The Network LayerThe Network Layer
The Network Layer
 
HDLC(High level Data Link Control)
HDLC(High level Data Link Control)HDLC(High level Data Link Control)
HDLC(High level Data Link Control)
 
DCCN Unit 1.pdf
DCCN Unit 1.pdfDCCN Unit 1.pdf
DCCN Unit 1.pdf
 
TCP IP Model | Computer Science
TCP IP Model | Computer ScienceTCP IP Model | Computer Science
TCP IP Model | Computer Science
 
Mobile Ad hoc Networks
Mobile Ad hoc NetworksMobile Ad hoc Networks
Mobile Ad hoc Networks
 
HDLC, PPP and SLIP
HDLC, PPP and SLIPHDLC, PPP and SLIP
HDLC, PPP and SLIP
 
User datagram protocol (udp)
User datagram protocol (udp)User datagram protocol (udp)
User datagram protocol (udp)
 
Transport Layer
Transport LayerTransport Layer
Transport Layer
 
Traffic-adaptive Medium Access Protocol
Traffic-adaptive Medium Access ProtocolTraffic-adaptive Medium Access Protocol
Traffic-adaptive Medium Access Protocol
 
TCP- Transmission Control Protocol
TCP-  Transmission Control Protocol TCP-  Transmission Control Protocol
TCP- Transmission Control Protocol
 
Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)Overview of SCTP (Stream Control Transmission Protocol)
Overview of SCTP (Stream Control Transmission Protocol)
 
Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)Transmission Control Protocol (TCP)
Transmission Control Protocol (TCP)
 
Tcp/Ip Model
Tcp/Ip ModelTcp/Ip Model
Tcp/Ip Model
 
Physical And Data Link Layers
Physical And Data Link LayersPhysical And Data Link Layers
Physical And Data Link Layers
 
Tcp
TcpTcp
Tcp
 
Ch 19 Network-layer protocols Section 1
Ch 19  Network-layer protocols Section 1Ch 19  Network-layer protocols Section 1
Ch 19 Network-layer protocols Section 1
 
Cs8591 Computer Networks
Cs8591 Computer NetworksCs8591 Computer Networks
Cs8591 Computer Networks
 
wn_Chapter_6_MAC.pdf
wn_Chapter_6_MAC.pdfwn_Chapter_6_MAC.pdf
wn_Chapter_6_MAC.pdf
 

Destaque

Lecture 3,4 operating systems
Lecture 3,4   operating systemsLecture 3,4   operating systems
Lecture 3,4 operating systems
Pradeep Kumar TS
 
Lecture 1 introduction to operating systems
Lecture 1  introduction to operating systemsLecture 1  introduction to operating systems
Lecture 1 introduction to operating systems
Pradeep Kumar TS
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
Pradeep Kumar TS
 

Destaque (20)

Virtual classrooms and labs using Big Blue Button
Virtual classrooms and labs using Big Blue ButtonVirtual classrooms and labs using Big Blue Button
Virtual classrooms and labs using Big Blue Button
 
Challenges in Embedded Computing
Challenges in Embedded ComputingChallenges in Embedded Computing
Challenges in Embedded Computing
 
Tracing and awk in ns2
Tracing and awk in ns2Tracing and awk in ns2
Tracing and awk in ns2
 
OSI Layers
OSI Layers OSI Layers
OSI Layers
 
Functions of osi layer in computer networks
Functions of osi layer in computer networksFunctions of osi layer in computer networks
Functions of osi layer in computer networks
 
IEEE 802 Standard for Computer Networks
IEEE 802 Standard for Computer NetworksIEEE 802 Standard for Computer Networks
IEEE 802 Standard for Computer Networks
 
Lecture 7 cpu scheduling
Lecture 7   cpu schedulingLecture 7   cpu scheduling
Lecture 7 cpu scheduling
 
Lecture 3,4 operating systems
Lecture 3,4   operating systemsLecture 3,4   operating systems
Lecture 3,4 operating systems
 
An overview of TCP (Transmission Control Protocol)
An overview of TCP (Transmission Control Protocol)An overview of TCP (Transmission Control Protocol)
An overview of TCP (Transmission Control Protocol)
 
Cs problem [repaired]
Cs problem [repaired]Cs problem [repaired]
Cs problem [repaired]
 
Lecture 1 introduction to operating systems
Lecture 1  introduction to operating systemsLecture 1  introduction to operating systems
Lecture 1 introduction to operating systems
 
Hardware7
Hardware7Hardware7
Hardware7
 
Computer Networks Lab File
Computer Networks Lab FileComputer Networks Lab File
Computer Networks Lab File
 
QEMU Disk IO Which performs Better: Native or threads?
QEMU Disk IO Which performs Better: Native or threads?QEMU Disk IO Which performs Better: Native or threads?
QEMU Disk IO Which performs Better: Native or threads?
 
Inter process communication
Inter process communicationInter process communication
Inter process communication
 
Software Defined Networking - 1
Software Defined Networking - 1Software Defined Networking - 1
Software Defined Networking - 1
 
Lecture 5 process concept
Lecture 5   process conceptLecture 5   process concept
Lecture 5 process concept
 
Operating System fo IoT
Operating System fo IoTOperating System fo IoT
Operating System fo IoT
 
Ch24
Ch24Ch24
Ch24
 
TCPIP
TCPIPTCPIP
TCPIP
 

Semelhante a Introduction to TCP

NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdfNetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
optokunal1
 
Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................
SwatiHans10
 

Semelhante a Introduction to TCP (20)

6610-l14.pptx
6610-l14.pptx6610-l14.pptx
6610-l14.pptx
 
Computer networks unit iv
Computer networks    unit ivComputer networks    unit iv
Computer networks unit iv
 
TCP protocol flow control
TCP protocol flow control TCP protocol flow control
TCP protocol flow control
 
tcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptx
tcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptxtcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptx
tcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptx
 
congestion control data communication.pdf
congestion control data communication.pdfcongestion control data communication.pdf
congestion control data communication.pdf
 
Working of TCP
Working of TCP Working of TCP
Working of TCP
 
Congestion control in tcp
Congestion control in tcpCongestion control in tcp
Congestion control in tcp
 
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdfNetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion Avoidance
 
TCP timers in transport layer .pptx
TCP timers in  transport layer     .pptxTCP timers in  transport layer     .pptx
TCP timers in transport layer .pptx
 
Tcp(no ip) review part1
Tcp(no ip) review part1Tcp(no ip) review part1
Tcp(no ip) review part1
 
Transport layer
Transport layerTransport layer
Transport layer
 
Mobile comn.pptx
Mobile comn.pptxMobile comn.pptx
Mobile comn.pptx
 
Tieu luan qo s
Tieu luan qo sTieu luan qo s
Tieu luan qo s
 
Tcp Reliability Flow Control
Tcp Reliability Flow ControlTcp Reliability Flow Control
Tcp Reliability Flow Control
 
Transmission control protocol ...............................
Transmission control protocol ...............................Transmission control protocol ...............................
Transmission control protocol ...............................
 
Congestion Control
Congestion ControlCongestion Control
Congestion Control
 
High Performance Networking with Advanced TCP
High Performance Networking with Advanced TCPHigh Performance Networking with Advanced TCP
High Performance Networking with Advanced TCP
 
Data link layer elementry protocols
Data link layer elementry protocolsData link layer elementry protocols
Data link layer elementry protocols
 
NE #1.pptx
NE #1.pptxNE #1.pptx
NE #1.pptx
 

Mais de Pradeep Kumar TS

Mais de Pradeep Kumar TS (20)

Digital Portfolio and Footprint
Digital Portfolio and FootprintDigital Portfolio and Footprint
Digital Portfolio and Footprint
 
Open book Examination
Open book ExaminationOpen book Examination
Open book Examination
 
Software Define Networking (SDN)
Software Define Networking (SDN)Software Define Networking (SDN)
Software Define Networking (SDN)
 
What next - Career Enhancement of Graduates
What next - Career Enhancement of GraduatesWhat next - Career Enhancement of Graduates
What next - Career Enhancement of Graduates
 
Protothreads
ProtothreadsProtothreads
Protothreads
 
6LoWPAN
6LoWPAN 6LoWPAN
6LoWPAN
 
Software Defined Networks
Software Defined NetworksSoftware Defined Networks
Software Defined Networks
 
Higher Order Thinking - Question paper setting
Higher Order Thinking - Question paper settingHigher Order Thinking - Question paper setting
Higher Order Thinking - Question paper setting
 
IoT Communication Protocols
IoT Communication ProtocolsIoT Communication Protocols
IoT Communication Protocols
 
IoT Applications
IoT ApplicationsIoT Applications
IoT Applications
 
RPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy NetworksRPL - Routing Protocol for Low Power and Lossy Networks
RPL - Routing Protocol for Low Power and Lossy Networks
 
Mannasim for NS2
Mannasim for NS2Mannasim for NS2
Mannasim for NS2
 
Recompiling network simulator 2
Recompiling network simulator 2Recompiling network simulator 2
Recompiling network simulator 2
 
OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2OTcl and C++ linkages in NS2
OTcl and C++ linkages in NS2
 
Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2Wired and Wireless Examples in ns2
Wired and Wireless Examples in ns2
 
Installation of ns2
Installation of ns2Installation of ns2
Installation of ns2
 
Introduction to ns2
Introduction to ns2Introduction to ns2
Introduction to ns2
 
Software Defined Networking - 2
Software Defined Networking - 2Software Defined Networking - 2
Software Defined Networking - 2
 
Software Defined Networking - 3
Software Defined Networking - 3Software Defined Networking - 3
Software Defined Networking - 3
 
Evaluation in higher education
Evaluation in higher educationEvaluation in higher education
Evaluation in higher education
 

Último

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
 

Último (20)

Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
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
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
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
 
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...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.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
 
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...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
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
 
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
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Introduction to TCP

  • 1. Transmission Control Protocol (TCP) T S Pradeep Kumar VIT Chennai http://www.nsnam.com
  • 2. TCP Introduction • Process to Process communication like UDP • Stream Delivery service (Stream of Packets) • Uses buffers at sending and receiving • Segments • Full Duplex • Connection Oriented • Reliable
  • 3. TCP
  • 4. TCP with Pseudo Headers
  • 6. Connection Establishment • Three Way handshaking • passive open, active open • Data Transfer • Connection Termination • Connection Reset • deny (, abort (abnormal, use RST) , terminate (idle for long time, Use RST)
  • 7. TCP • A SYN segment cannot carry data, but consumes one sequence number • A SYN +ACK segment cannot carry data, but consumes one sequence number. • An ACK segment, if carrying no data, consumes no sequence number.
  • 11. Windows in TCP • send window • receive window
  • 13. Window in TCP • rwnd = buffer size - number of waiting bytes to be pulled • send window will open, close and shrink • receive window will never shrink
  • 14. Flow Control • Opening and closing of windows • Send window • closes if the receiver tells (when ack comes) • opens move the right wall to right (based on rwnd) • on some occasions it shrinks • receive window • closes (left wall moves to right) when more bytes arrive • opens (right wall moves to right) when bytes consumed by process
  • 16.
  • 17. Error Control • error control for • detecting and resending corrupted segments • resending lost segments • storing out of order segments • detecting and discarding duplicated segments. • Error control achieved by • checksum • acknowledgement • Time out
  • 18. Checksum • Each segment carries a checksum value. • If a segment is corrupted as deleted by an invalid checksum, the segment is discarded and considered as lost.
  • 19. Acknowledgement • Control and data segments consumes a sequence number, so they will be acknowledged • but ACK segments do not consume sequence numbers and they are not acknowledged • Types of acknowledgement • cumulative (ACK) • selective (SACK)
  • 20. Acknowledgement • Cumulative (ACK) • sends the ack with a segment to be received • ignoring all the out of order or lost segments • Selective ack (SACK) • cumulative ack + additional information to the sender • reports the block of data that are out of order, duplicated segments. • usually this is implemented in the options field of the TCP headers.
  • 21. ACK • Retransmission of segments • The segments are stored until the ACK is sent • a segment is retransmited • if three duplicate ACKs are received for the first segment • retransmission timer expires • Out of Order Segments • they are never discarded but stored temporarily until the missing segments arrive • but they are never delivered to the process
  • 24. Congestion Control • There are two windows • rwnd (receiver window) • cwnd (congestion window) • congestion window is the window in the network • Sender window = minimum (rwnd, cwnd) • sender will reduce the window size based on the receiver and network window size.
  • 25. Congestion Control • Slow start • exponential increase till the threshold is reached • then congestion avoidance, if congestion is detected, goes back to slow start or congestion avoidance • Congestion avoidance • congestion detection
  • 26. Slow Start Threshold • Starts the congestion window size with Maximum Segment Size (1) • Increase exponentially, for each ACK, the cwnd is increased by 1. • When it reaches the threshold, the phase changes to congestion avoidance (additive increase of cwnd). • If multiple segments are acknowledge accumulatively, the MSS increases to 1 and not 3. But still the growth is exponential, but not in powers of 2
  • 28. Congestion Avoidance • Additive increase of window size • when whole window of segments, the size of the congestion is increase by one • This phase will go on until congestion is detected. • Once congestion is detected, the system goes back to ssthrehold or congestion avoidance based on the severity of the congestion.
  • 30. Congestion Detection • Multiplicative Decrease • Sender understands the congestion, only when there is a need to retransmit a segment • RTO timer expires (Severe congestion) • Three duplicate ACKs (Mild congestion)
  • 31. Congestion detection • If a time-out occurs, there is a stronger possibility of congestion; a segment has probably been dropped in the network and there is no news about the following sent segments. In this case TCP reacts strongly: • It sets the value of the threshold to half of the current window size. • It reduces cwnd back to one segment • It starts the slow start phase again.
  • 32. Congestion Detection • If three duplicate ACKs are received, there is a weaker possibility of congestion; a segment may have been dropped but some segments after that have arrived safely since three duplicate ACKs are received. This is called fast transmission and fast recovery. In this case, TCP has a weaker reaction as shown below: • It sets the value of the threshold to half of the current window size. • It sets cwnd to the value of the threshold (some implementations add three segment sizes to the threshold). • It starts the congestion avoidance phase.
  • 34. Tcp Timers • Timers • Retransmission • Persistence • Keepalive • TIME WAIT
  • 35. Retransmission Timers • To retransmit lost segments, TCP employs one retransmission timer (for the whole connection period) that handles the retransmission time-out (RTO), the waiting time for a acknowledgment of a segment. • When TCP sends the segment in front of the sending queue, it starts the timer. • When the timer expires, TCP resends the first segment in front of the queue, and restarts the timer. • When a segment (or segments) are cumulatively acknowledged, the segment (or segments) are purged from the queue. • If the queue is empty, TCP stops the timer; otherwise, TCP restarts the timer.
  • 36. Persistence Timer • This timer is started when a size zero window is received by the sender. • Once a size zero window received, persistence timer is started and the sending node sends a special segment called a probe (1byte data which consumes a sequence number but this probe will never be acknowledged) • The probe causes the receiving TCP to resend the acknowledgment. • This process will go on until the non zero window size is received by the sender.
  • 37. Keepalive Timer • This timer is to prevent a long idle connection between two TCPs • If a client is crashed after it opens a Tcp connection, the connection is open forever. • So a server is running with a keepalive timer • Each time the server hears from a client, it resets this timer. • The time-out is usually 2 hours. • If the server does not hear from the client after 2 hours, it sends a probe segment. If there is no response after 10 probes, each of which is 75 s apart, it assumes that the client is down and terminates the connection.
  • 38. TIME WAIT Timer • Timer is used during connection termination • When the FIN segment is received, the client sends an ACK segment and goes to the TIME-WAIT state and sets a timer for a time-out value of twice the maximum segment lifetime (MSL).