T S Pradeep Kumar
• Process to Process communication like UDP
• Stream Delivery service (Stream of Packets)
• Uses buffers at sending and receiving
• Full Duplex
• Connection Oriented
• 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)
• A SYN segment cannot carry data, but consumes one
• A SYN +ACK segment cannot carry data, but
consumes one sequence number.
• An ACK segment, if carrying no data, consumes no
Window in TCP
• rwnd = buffer size - number of waiting bytes to be
• send window will open, close and shrink
• receive window will never shrink
• 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
• 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
• Time out
• Each segment carries a checksum value.
• If a segment is corrupted as deleted by an invalid
checksum, the segment is discarded and considered
• 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)
• 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
• usually this is implemented in the options ﬁeld of the TCP headers.
• Retransmission of segments
• The segments are stored until the ACK is sent
• a segment is retransmited
• if three duplicate ACKs are received for the ﬁrst segment
• retransmission timer expires
• Out of Order Segments
• they are never discarded but stored temporarily until the missing
• but they are never delivered to the process
• 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.
• Slow start
• exponential increase till the threshold is reached
• then congestion avoidance, if congestion is
detected, goes back to slow start or congestion
• Congestion avoidance
• congestion detection
Slow Start Threshold
• Starts the congestion window size with Maximum Segment Size
• 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
• 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.
• 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)
• 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.
• 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
• It sets the value of the threshold to half of the current window
• It sets cwnd to the value of the threshold (some
implementations add three segment sizes to the threshold).
• It starts the congestion avoidance phase.
• 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
• When the timer expires, TCP resends the ﬁrst 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
• This timer is started when a size zero window is received by
• 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
• This process will go on until the non zero window size is
received by the sender.
• 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
• 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
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).
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.