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
Introduction to TCP
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).

More Related Content

PPTX
PPT
An overview of TCP (Transmission Control Protocol)
PDF
TCP - Transmission Control Protocol
PPTX
Wireless application protocol
PPTX
PPT
Selective repeat protocol
PPT
stop and wait
PPTX
Mobile transport layer - traditional TCP
An overview of TCP (Transmission Control Protocol)
TCP - Transmission Control Protocol
Wireless application protocol
Selective repeat protocol
stop and wait
Mobile transport layer - traditional TCP

What's hot (20)

PPT
Internet control message protocol
PPT
Chap 12 tcp
PDF
Stop and-wait protocol
PPTX
TCP protocol flow control
PPTX
Igmp presentation
PPTX
Transmission control protocol
PPTX
Error control
PPTX
Flow control in Computer Network
PPT
Flow control and error control
PPTX
Leaky Bucket & Tocken Bucket - Traffic shaping
PPTX
Media Access Control (MAC Layer)
PPTX
Routing ppt
PPSX
Flow Control
PPTX
Csma protocols
DOCX
16 x 16 banyan switch
PDF
Cs8591 Computer Networks
PPTX
RACH Procedures
PPTX
Multiple access protocol
PPT
Multicast Routing Protocols
PPTX
Spanning tree protocol
Internet control message protocol
Chap 12 tcp
Stop and-wait protocol
TCP protocol flow control
Igmp presentation
Transmission control protocol
Error control
Flow control in Computer Network
Flow control and error control
Leaky Bucket & Tocken Bucket - Traffic shaping
Media Access Control (MAC Layer)
Routing ppt
Flow Control
Csma protocols
16 x 16 banyan switch
Cs8591 Computer Networks
RACH Procedures
Multiple access protocol
Multicast Routing Protocols
Spanning tree protocol
Ad

Viewers also liked (20)

PDF
Virtual classrooms and labs using Big Blue Button
PDF
Challenges in Embedded Computing
PDF
Tracing and awk in ns2
PDF
OSI Layers
PDF
Functions of osi layer in computer networks
PDF
IEEE 802 Standard for Computer Networks
PPTX
Lecture 7 cpu scheduling
PPTX
Lecture 3,4 operating systems
PPTX
Cs problem [repaired]
PPTX
Lecture 1 introduction to operating systems
PPT
Hardware7
DOCX
Computer Networks Lab File
PDF
QEMU Disk IO Which performs Better: Native or threads?
PPTX
Inter process communication
PDF
Software Defined Networking - 1
PPTX
Lecture 5 process concept
PDF
Operating System fo IoT
PPT
PDF
Chapter 3 : User Datagram Protocol (UDP)
Virtual classrooms and labs using Big Blue Button
Challenges in Embedded Computing
Tracing and awk in ns2
OSI Layers
Functions of osi layer in computer networks
IEEE 802 Standard for Computer Networks
Lecture 7 cpu scheduling
Lecture 3,4 operating systems
Cs problem [repaired]
Lecture 1 introduction to operating systems
Hardware7
Computer Networks Lab File
QEMU Disk IO Which performs Better: Native or threads?
Inter process communication
Software Defined Networking - 1
Lecture 5 process concept
Operating System fo IoT
Chapter 3 : User Datagram Protocol (UDP)
Ad

Similar to Introduction to TCP (20)

PPT
the TCP transmission control protocol
PPTX
6610-l14.pptx
PPTX
Computer networks unit iv
PPTX
tcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptx
PDF
congestion control data communication.pdf
PPTX
Working of TCP
PPTX
Congestion control in tcp
PDF
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
PPT
Tcp Congestion Avoidance
PPTX
TCP timers in transport layer .pptx
PPTX
Tcp(no ip) review part1
PPT
Transmission control protocol _
PPT
PPTX
Transport layer
PPTX
Mobile comn.pptx
PPTX
Tieu luan qo s
PPT
Tcp Reliability Flow Control
PPT
Transmission control protocol ...............................
DOC
Congestion Control
PPTX
High Performance Networking with Advanced TCP
the TCP transmission control protocol
6610-l14.pptx
Computer networks unit iv
tcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptx
congestion control data communication.pdf
Working of TCP
Congestion control in tcp
NetWork Design Question2.) How does TCP prevent Congestion Dicuss.pdf
Tcp Congestion Avoidance
TCP timers in transport layer .pptx
Tcp(no ip) review part1
Transmission control protocol _
Transport layer
Mobile comn.pptx
Tieu luan qo s
Tcp Reliability Flow Control
Transmission control protocol ...............................
Congestion Control
High Performance Networking with Advanced TCP

More from Pradeep Kumar TS (20)

PDF
Digital Portfolio and Footprint
PDF
Open book Examination
PDF
Software Define Networking (SDN)
PDF
What next - Career Enhancement of Graduates
PDF
Protothreads
PDF
PDF
Software Defined Networks
PDF
Higher Order Thinking - Question paper setting
PDF
IoT Communication Protocols
PDF
IoT Applications
PDF
RPL - Routing Protocol for Low Power and Lossy Networks
PDF
Mannasim for NS2
PDF
Recompiling network simulator 2
PDF
OTcl and C++ linkages in NS2
PDF
Wired and Wireless Examples in ns2
PDF
Installation of ns2
PDF
Introduction to ns2
PDF
Software Defined Networking - 2
PDF
Software Defined Networking - 3
PDF
Evaluation in higher education
Digital Portfolio and Footprint
Open book Examination
Software Define Networking (SDN)
What next - Career Enhancement of Graduates
Protothreads
Software Defined Networks
Higher Order Thinking - Question paper setting
IoT Communication Protocols
IoT Applications
RPL - Routing Protocol for Low Power and Lossy Networks
Mannasim for NS2
Recompiling network simulator 2
OTcl and C++ linkages in NS2
Wired and Wireless Examples in ns2
Installation of ns2
Introduction to ns2
Software Defined Networking - 2
Software Defined Networking - 3
Evaluation in higher education

Recently uploaded (20)

PPTX
TNA_Presentation-1-Final(SAVE)) (1).pptx
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
AI-driven educational solutions for real-life interventions in the Philippine...
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
Practical Manual AGRO-233 Principles and Practices of Natural Farming
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PDF
HVAC Specification 2024 according to central public works department
PPTX
Virtual and Augmented Reality in Current Scenario
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Uderstanding digital marketing and marketing stratergie for engaging the digi...
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PPTX
Computer Architecture Input Output Memory.pptx
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
TNA_Presentation-1-Final(SAVE)) (1).pptx
What if we spent less time fighting change, and more time building what’s rig...
AI-driven educational solutions for real-life interventions in the Philippine...
Weekly quiz Compilation Jan -July 25.pdf
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
Practical Manual AGRO-233 Principles and Practices of Natural Farming
B.Sc. DS Unit 2 Software Engineering.pptx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
HVAC Specification 2024 according to central public works department
Virtual and Augmented Reality in Current Scenario
Paper A Mock Exam 9_ Attempt review.pdf.
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Uderstanding digital marketing and marketing stratergie for engaging the digi...
Introduction to pro and eukaryotes and differences.pptx
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
FORM 1 BIOLOGY MIND MAPS and their schemes
Computer Architecture Input Output Memory.pptx
202450812 BayCHI UCSC-SV 20250812 v17.pptx

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
  • 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).