SlideShare une entreprise Scribd logo
1  sur  38
Télécharger pour lire hors ligne
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).

Contenu connexe

Tendances

Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc
Chandra Meena
 
resource management
  resource management  resource management
resource management
Ashish Kumar
 

Tendances (20)

User datagram protocol (udp)
User datagram protocol (udp)User datagram protocol (udp)
User datagram protocol (udp)
 
CSMA/CA
CSMA/CACSMA/CA
CSMA/CA
 
CSMA /CD PPT ON SLIDESHARE
CSMA /CD PPT ON SLIDESHARECSMA /CD PPT ON SLIDESHARE
CSMA /CD PPT ON SLIDESHARE
 
Multicast routing
Multicast routingMulticast routing
Multicast routing
 
Icmp
IcmpIcmp
Icmp
 
Congestion control in TCP
Congestion control in TCPCongestion control in TCP
Congestion control in TCP
 
TCP - Transmission Control Protocol
TCP - Transmission Control ProtocolTCP - Transmission Control Protocol
TCP - Transmission Control Protocol
 
Tcp presentation
Tcp presentationTcp presentation
Tcp presentation
 
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)
 
L2 tp
L2 tpL2 tp
L2 tp
 
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)
 
Data link layer
Data link layerData link layer
Data link layer
 
Tcp Congestion Avoidance
Tcp Congestion AvoidanceTcp Congestion Avoidance
Tcp Congestion Avoidance
 
Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc
 
Distance Vector Routing Protocols
Distance Vector Routing ProtocolsDistance Vector Routing Protocols
Distance Vector Routing Protocols
 
TCP - IP Presentation
TCP - IP PresentationTCP - IP Presentation
TCP - IP Presentation
 
TCP/IP
TCP/IPTCP/IP
TCP/IP
 
What Is Sliding Window Protocol?
What Is Sliding Window Protocol?What Is Sliding Window Protocol?
What Is Sliding Window Protocol?
 
Data link control & protocol concepts
Data link control & protocol conceptsData link control & protocol concepts
Data link control & protocol concepts
 
resource management
  resource management  resource management
resource management
 

En vedette

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
 

En vedette (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
 
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
 
TCP protocol flow control
TCP protocol flow control TCP protocol flow control
TCP protocol flow control
 

Similaire à 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
 

Similaire à 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
 
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 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
 
Comparison of TCP congestion control mechanisms Tahoe, Newreno and Vegas
Comparison of TCP congestion control mechanisms Tahoe, Newreno and VegasComparison of TCP congestion control mechanisms Tahoe, Newreno and Vegas
Comparison of TCP congestion control mechanisms Tahoe, Newreno and Vegas
 
Comparison of TCP congestion control mechanisms Tahoe, Newreno and Vegas
Comparison of TCP congestion control mechanisms Tahoe, Newreno and VegasComparison of TCP congestion control mechanisms Tahoe, Newreno and Vegas
Comparison of TCP congestion control mechanisms Tahoe, Newreno and Vegas
 

Plus de Pradeep Kumar TS

Plus 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
 

Dernier

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
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
 
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
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Dernier (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
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
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
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
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
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
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
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
 
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
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
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
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 

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