SlideShare a Scribd company logo
​
JIMS Engineering Management Technical Campus
48/4, Knowledge park-III,Greater Noida, UP-201306
(Affiliated to Guru Gobind Singh Indraprastha University, New Delhi)
Subject Name: Computer Networks
Subject Code: ETCS-306
Department of CSE
Subject: Computer Networks
Topic: Transmission Control Protocol
3
Overview
TCP = Transmission Control Protocol
▰ Connection-oriented protocol
▰ Provides a reliable unicast end-to-end byte stream over
an unreliable internetwork.
TCP
IP Internetwork
Byte
Stream
Byte
Stream
TCP
4
Connection-Oriented
▰ Before any data transfer, TCP establishes a connection:
▻ One TCP entity is waiting for a connection (“server”)
▻ The other TCP entity (“client”) contacts the server
▰ The actual procedure for setting up connections is more complex.
▰ Each connection is full duplex
CLIENT SERVER
waiting for
connection
request
Request a connection
Accept a connection
Disconnect
Data Transer
5
Reliable
• Byte stream is broken up into chunks which are called seg-ments
• Receiver sends acknowledgements (ACKs) for segments
• TCP maintains a timer. If an ACK is not received in time,
the segment is retransmitted
•Detecting errors:
• TCP has checksums for header and data. Segments with
invalid checksums are discarded
• Each byte that is transmitted has a sequence number
6
Byte Stream Service
▰ To the lower layers, TCP handles data in blocks, the segments.
▰ To the higher layers TCP handles data as a sequence of bytes and
does not identify boundaries between bytes
▰ So: Higher layers do not know about the beginning and
end of segments !
TCP
Application
1. write 100 bytes
2. write 20 bytes
queue of
bytes to be
transmitted TCP
queue of
bytes that
have been
received
Application
1. read 40 bytes
2. read 40 bytes
3. read 40 bytes
Segments
7
TCP Format
IP header TCP header TCP data
Sequence number (32 bits)
DATA
20 bytes 20 bytes
0 15 16 31
Source Port Number Destination Port Number
Acknowledgement number (32 bits)
window size
header
length
0 Flags
Options (if any)
TCP checksum urgent pointer
20
bytes
• TCP segments have a 20 byte header with >= 0 bytes of data.
8
TCP header fields
▰ Port Number:
▻ A port number identifies the endpoint of a connection.
▻ A pair <IP address, port number> identifies one endpoint of a
connection.
▻ Two pairs <client IP address, client port number> and <server
IP address, server port number> identify a TCP connection.
TCP
IP
Applications
23 104
80
Ports:
TCP
IP
Applications
7 16
80 Ports:
9
TCP header fields
9
Sequence Number (SeqNo):
 Sequence number is 32 bits long.
 So the range of SeqNo is
0 <= SeqNo <= 232
-1  4.3 Gbyte
 TCP uses sequence numbers to keep track
of transmitted and acknowledged data
 Each transmitted byte of payload data is
associated with a sequence number
 Sequence numbers count bytes and
not segments
 Sequence number of first byte in payload
is written in SeqNo field
 The sequence number of the first sequence
number (Initial sequence number) is
negotiated during connection setup
Sequence number (SeqNo) (32 bits)
Source Port Number Destination Port Number
Acknowledgement number (AckNo)(32 bits)
window size
header
length
0 Flags
TCP checksum urgent pointer
TCP header fields
 An acknowledgment is a confirmation
of delivery of data
 When a TCP receiver wants to
acknowledge data, it
 writes a sequence number in the
AckNo field, and
 sets the ACK flag
IMPORTANT: An acknowledgment
confirms receipt for all
unacknowledged data that has a
smaller sequence number than given in
the AckNo field
Example: AckNo=5 confirms delivery for
1,2,3,4 (but not 5).
Sequence number (SeqNo) (32 bits)
Source Port Number Destination Port Number
Acknowledgement number (AckNo)(32 bits)
window size
header
length
0 Flags
TCP checksum urgent pointer
11
TCP header fields:
▰ Header Length ( 4bits):
▻ TCP header has variable length (with minimum 20 bytes)
▰ Flag bits
▻ URG: Urgent pointer is valid
▻ If the bit is set, the following bytes contain an urgent message in the range:
SeqNo <= urgent message <= SeqNo+urgent pointer
▻ ACK: Acknowledgement Number is valid
▻ PSH: PUSH Flag
▻ Notification from sender to the receiver that the receiver should pass all data
that it has to the application.
▻ RST: Reset the connection
▻ The flag causes the receiver to reset the connection
▻ SYN: Synchronize sequence numbers
▻ Sent in the first packet when initiating a connection
▻ FIN: Sender is finished with sending
▻ Used for closing a connection
▻ Both sides of a connection must send a FIN
12
TCP header fields
▰ Window Size:
▻ Each side of the connection advertises the window size
▻ Window size is the maximum number of bytes that a receiver can accept.
▻ Maximum window size is 216
-1= 65535 bytes
▰ TCP Checksum:
▻ TCP checksum covers over both TCP header and TCP data (also covers
some parts of the IP header)
▰ Urgent Pointer:
▻ Only valid if URG flag is set
▰ Options: field provides a way to add extra facilities not covered by the
regular header.
The TCP Service Model
Some assigned ports.
Port Protocol Use
21 FTP File transfer
23 Telnet Remote login
25 SMTP E-mail
69 TFTP Trivial File Transfer Protocol
79 Finger Lookup info about a user
80 HTTP World Wide Web
110 POP-3 Remote e-mail access
Thank You !!
Connection
Management in TCP
16
▰ Opening a TCP Connection
▰ Closing a TCP Connection
▰ Special Scenarios
▰ State Diagram
17
TCP Connection
Establishment
▰ TCP uses a three-way handshake to open a connection:
(1) ACTIVE OPEN: Client sends a segment with
▻ SYN bit set *
▻ port number of client
▻ initial sequence number (ISN) of client
(2) PASSIVE OPEN: Server responds with a segment with
▻ SYN bit set *
▻ initial sequence number of server
▻ ACK for ISN of client
(3) Client acknowledges by sending a segment with:
▻ ACK ISN of server (* counts as
one byte)
Three-Way Handshake
(a) TCP connection establishment in the normal case.
(b) Call collision.
6-31
19
A Closer Look with
tcpdump
1 aida.poly.edu.1121 > mng.poly.edu.telnet: S
1031880193:1031880193(0)
win 16384 <mss 1460,nop,wscale
0,nop,nop,timestamp>
2 mng.poly.edu.telnet > aida.poly.edu.1121: S
172488586:172488586(0)
ack 1031880194 win 8760 <mss 1460>
3 aida.poly.edu.1121 > mng.poly.edu.telnet: . ack 172488587 win 17520
4 aida.poly.edu.1121 > mng.poly.edu.telnet: P
1031880194:1031880218(24)
ack 172488587 win 17520
5 mng.poly.edu.telnet > aida.poly.edu.1121: P 172488587:172488590(3)
ack 1031880218 win 8736
6 aida.poly.edu.1121 > mng.poly.edu.telnet: P
1031880218:1031880221(3)
ack 172488590 win 17520
aida.poly.edu mng.poly.edu
aida issues
an "telnet mng"
20
Three-Way
Handshake
aida.poly.edu mng.poly.edu
S 1031880193:1031880193(0)
win 16384 <mss 1460, ...>
S 172488586:172488586(0)
ack 1031880194 win 8760 <mss 1460>
ack 172488587 win 17520
Why is a Two-Way
Handshake not enough?
aida.poly.edu mng.poly.edu
S 15322112354:15322112354(0)
win 16384 <mss 1460, ...>
S 172488586:172488586(0)
win 8760 <mss 1460>
S 1031880193:1031880193(0)
win 16384 <mss 1460, ...>
The red
line is a
delayed
duplicate
packet.
When aida initiates the data transfer (starting with
SeqNo=15322112355), mng will reject all data.
Will be discarded
as a duplicate
SYN
22
TCP Connection
Termination
▰ Each end of the data flow must be shut down
independently (“half-close”)
▰ If one end is done it sends a FIN segment. This
means that no more data will be sent
▰ Four steps involved:
(1) X sends a FIN to Y (active close)
(2) Y ACKs the FIN,
(at this time: Y can still send data to X)
(3) and Y sends a FIN to X (passive close)
(4) X ACKs the FIN.
23
Connection
termination with
tcpdump
1 mng.poly.edu.telnet > aida.poly.edu.1121: F
172488734:172488734(0)
ack
1031880221 win 8733
2 aida.poly.edu.1121 > mng.poly.edu.telnet: . ack
172488735 win 17484
3 aida.poly.edu.1121 > mng.poly.edu.telnet: F
1031880221:1031880221(0)
ack
172488735 win 17520
4 mng.poly.edu.telnet > aida.poly.edu.1121: . ack
1031880222 win 8733
aida.poly.edu mng.poly.edu
aida issues
an "telnet mng"
24
TCP Connection
Termination
aida.poly.edu mng.poly.edu
F 172488734:172488734(0)
ack 1031880221 win 8733
. ack 172488735 win 17484
. ack 1031880222 win 8733
F 1031880221:1031880221(0)
ack 172488735 win 17520
25
TCP States
State Description
CLOSED No connection is active or pending
LISTEN The server is waiting for an incoming call
SYN RCVD A connection request has arrived; wait for Ack
SYN SENT The client has started to open a connection
ESTABLISHED Normal data transfer state
FIN WAIT 1 Client has said it is finished
FIN WAIT 2 Server has agreed to release
TIMED WAIT Wait for pending packets (“2MSL wait state”)
CLOSING Both Sides have tried to close simultanesously
CLOSE WAIT Server has initiated a release
LAST ACK Wait for pending packets
26
TCP States in “Normal”
Connection Lifetime
SYN (SeqNo = x)
SYN (SeqNo = y, AckNo = x + 1 )
(AckNo = y + 1 )
SYN_SENT
(active open)
SYN_RCVD
ESTABLISHED
ESTABLISHED
FIN_WAIT_1
(active close)
LISTEN
(passive open)
FIN (SeqNo = m)
CLOSE_WAIT
(passive close)
(AckNo = m+ 1 )
FIN (SeqNo = n )
(AckNo = n+1)
LAST_ACK
FIN_WAIT_2
TIME_WAIT
CLOSED
27
TCP State Transition
Diagram
Opening A Connection
CLOSED
LISTEN
SYN RCVD SYN SENT
ESTABLISHED
active open
send: SYN
recv: SYN, ACK
send: ACK
recv: SYN
send: SYN, ACK
recvd: ACK
send: . / .
recv:
RST
Application sends data
send: SYN
simultaneous open
recv: SYN
send: SYN, ACK
close or
timeout
passive open
send: . / .
recvd: FIN send: FIN
send:
FIN
28
TCP State Transition
Diagram
Closing A Connection
FIN_WAIT_1
FIN_WAIT_2
ESTABLISHED
recv: FIN
send: ACK
recv: ACK
send: . / .
recvd: ACK
send: . / .
recv:
FIN, ACK
send: ACK
active close
send: FIN
TIME_WAIT
CLOSING
recv: FIN
send: ACK
CLOSED
Timeout
(2 MSL)
CLOSE_WAIT
LAST_ACK
passive close
recv: FIN
send: ACK
application
closes
send: FIN
recv: ACK
send: . / .
29
2MSL Wait State
2MSL Wait State = TIME_WAIT
▰ When TCP does an active close, and sends the final
ACK, the connection must stay in in the
TIME_WAIT state for twice the maximum
segment lifetime.
2MSL= 2 * Maximum Segment Lifetime
▰ Why?
TCP is given a chance to resent the final ACK. (Server
will timeout after sending the FIN segment and
resend the FIN)
▰ The MSL is set to 2 minutes or 1 minute or 30
seconds.
30
Resetting Connections
▰ Resetting connections is done by setting
the RST flag
▰ When is the RST flag set?
▻ Connection request arrives and no
server process is waiting on the
destination port
▻ Abort (Terminate) a connection
Causes the receiver to throw away
buffered data. Receiver does not
acknowledge the RST segment
31
TCP - Part II
32
What is
Flow/Congestion/Error
Control ?
• Flow Control: Algorithms to prevent that the sender
overruns the receiver with information
• Error Control: Algorithms to recover or conceal the
effects from packet losses
• Congestion Control: Algorithms to prevent that the sender
overloads the network
 The goal of each of the control mechanisms are different.
 In TCP, the implementation of these algorithms is combined
33
Acknowledgements
in TCP
▰ TCP receivers use acknowledgments
(ACKs) to confirm the receipt of data to
the sender
▰ Acknowledgment can be added
(“piggybacked”) to a data segment that
carries data in the opposite direction
▰ ACK information is included in the the
TCP header
▰ Acknowledgements are used for flow
control, error control, and congestion
control
Data for B
A B
Data for A ACK
ACK
34
Sequence Numbers and
Acknowledgments in
TCP
▰ TCP uses sequence numbers to keep track of
transmitted and acknowledged data
▰ Each transmitted byte of payload data is
associated with a sequence number
▰ Sequence numbers count bytes and not
segments
▰ Sequence number of first byte in payload is
written in SeqNo field
▰ Sequence numbers wrap when they reach 232
-1
▰ The sequence number of the first sequence
number (Initial sequence number) is negotiated
during connection setup
Sequence number (SeqNo) (32 bits)
Source Port Number Destination Port Number
Acknowledgement number (AckNo)(32 bits)
window size
header
length
0 Flags
TCP checksum urgent pointer
35
Sequence Numbers
and
Acknowledgments in
TCP
▰ An acknowledgment is a confirmation of
delivery of data
▰ When a TCP receiver wants to acknowledge
data, it
▻ writes a sequence number in the AckNo field,
and
▻ sets the ACK flag
IMPORTANT: An acknowledgment confirms
receipt for all unacknowledged data that has a
smaller sequence number than given in the
AckNo field
Example: AckNo=5 confirms delivery for 1,2,3,4
(but not 5).
Sequence number (SeqNo) (32 bits)
Source Port Number Destination Port Number
Acknowledgement number (AckNo)(32 bits)
window size
header
length
0 Flags
TCP checksum urgent pointer
36
Cumulative
Acknowledgements
▰ TCP has cumulative
acknowledgements:
An acknowledgment confirms the
receipt of all unacknowledged data with
a smaller sequence number
S
e
q
N
o
=
0
1
0
b
y
t
e
s
A
B
S
e
q
N
o
=
1
0
1
0
b
y
t
e
s
A
C
K
1
0
A
C
K
2
0
A
C
K
4
0
A
C
K
7
0
A
C
K
1
0
0
S
e
q
N
o
=
2
0
1
0
b
y
t
e
s
S
e
q
N
o
=
3
0
1
0
b
y
t
e
s
S
e
q
N
o
=
4
0
1
0
b
y
t
e
s
S
e
q
N
o
=
5
0
1
0
b
y
t
e
s
S
e
q
N
o
=
6
0
1
0
b
y
t
e
s
S
e
q
N
o
=
7
0
1
0
b
y
t
e
s
S
e
q
N
o
=
8
0
1
0
b
y
t
e
s
S
e
q
N
o
=
9
0
1
0
b
y
t
e
s
37
Cumulative
Acknowledgements
▰ With cumulative ACKs, the receiver can only
acknowledge a segment if all previous segments
have been received
▰ With cumulative ACKs, receiver cannot selectively
acknowledge blocks of segments:
e.g., ACK for S0-S3 and S5-S7 (but not for S4)
▰ Note: The use of cumulative ACKs imposes
constraints on the retransmission schemes:
▻ In case of an error, the sender may need to retransmit
all data that has not been acknowledged
38
Rules for sending
Acknowledgments
▰ TCP has rules that influence the transmission of
acknowledgments
▰ Rule 1: Delayed Acknowledgments
▻ Goal: Avoid sending ACK segments that do not carry data
▻ Implementation: Delay the transmission of (some) ACKs
▰ Rule 2: Nagle’s rule
▻ Goal: Reduce transmission of small segments
Implementation: A sender cannot send multiple segments
with a 1-byte payload (i.e., it must wait for an ACK)
39
Observing Delayed
Acknowledgements
• Remote terminal applications (e.g., Telnet) send characters to a
server. The server interprets the character and sends the output
at the server to the client.
• For each character typed, you see three packets:
1. Client  Server: Send typed character
2. Server  Client: Echo of character (or user output) and
acknowledgement for first packet
3. Client  Server: Acknowledgement for second packet
1.
send character
2.
interpret
character
3.
send echo of character
and/or output
Host with
Telnet client
Host with
Telnet server
40
Observing Delayed
Acknowledgements
▰ This is the output of typing 3 (three) characters :
Time 44.062449: Argon  Neon: Push, SeqNo 0:1(1), AckNo
1
Time 44.063317: Neon  Argon: Push, SeqNo 1:2(1), AckNo 1
Time 44.182705: Argon  Neon: No Data, AckNo 2
Time 48.946471: Argon  Neon: Push, SeqNo 1:2(1), AckNo
2
Time 48.947326: Neon  Argon: Push, SeqNo 2:3(1), AckNo
2
Time 48.982786: Argon  Neon: No Data, AckNo 3
Time 55.116581: Argon  Neon: Push, SeqNo 2:3(1) AckNo
3
Time 55.117497: Neon  Argon: Push, SeqNo 3:4(1) AckNo 3
Time 55.183694: Argon  Neon: No Data, AckNo 4
Argon Neon
Telnet session
from Argon
to Neon
41
Why 3 segments per
character?
▰ We would expect four segments per
character:
▰ But we only see three segments per
character:
▰ This is due to delayed
acknowledgements
character
ACK of character
ACK of echoed character
echo of character
character
ACK and echo of character
ACK of echoed character
42
Delayed
Acknowledgement
▰ TCP delays transmission of ACKs for up to 200ms
▰ Goal: Avoid to send ACK packets that do not carry data.
▻ The hope is that, within the delay, the receiver will have
data ready to be sent to the receiver. Then, the ACK
can be piggybacked with a data segment
In Example:
▻ Delayed ACK explains why the “ACK of character” and the “echo of
character” are sent in the same segment
▻ The duration of delayed ACKs can be observed in the example when Argon
sends ACKs
Exceptions:
▰ ACK should be sent for every second full sized segment
▰ Delayed ACK is not used when packets arrive out of
order
▰ Because of delayed ACKs, an ACK is
often observed for every other
segment
Delayed Acknowledgement
S
e
q
N
o
=
0
1
0
b
y
t
e
s
A
B
S
e
q
N
o
=
1
0
1
0
b
y
t
e
s
A
C
K
2
0
A
C
K
4
0
A
C
K
5
0
A
C
K
9
0
S
e
q
N
o
=
2
0
1
0
b
y
t
e
s
S
e
q
N
o
=
3
0
1
0
b
y
t
e
s
S
e
q
N
o
=
4
0
1
0
b
y
t
e
s
S
e
q
N
o
=
5
0
1
0
b
y
t
e
s
S
e
q
N
o
=
6
0
1
0
b
y
t
e
s
S
e
q
N
o
=
7
0
1
0
b
y
t
e
s
S
e
q
N
o
=
8
0
1
0
b
y
t
e
s
Max. Delay
for an ACK
A
C
K
7
0
44
Observing Nagle’s Rule
▰ Observations:
▻ Argon never has multiple unacknowledged segments
outstanding
▻ There are fewer transmissions than there are
characters.
▰ This is due to Nagle’s Rule:
▻ Each TCP connection can have only one small (1-byte)
segment outstanding that has not been acknowledged
▰ Implementation: Send one byte and buffer all
subsequent bytes until acknowledgement is received.
Then send all buffered bytes in a single segment. (Only
enforced if byte is arriving from application one byte at a
time).
▰ Goal of Nagle’s Rule: Reduce the amount of small
segments.
▰ The algorithm can be disabled.
45
▰ Only one 1-byte segment can be in
transmission (Here: Since no data is sent
from B to A, we also see delayed ACKs)
Nagle’s Rule
A
C
K
1
S
e
q
N
o
=
0
,
1
b
y
t
e
A
B
A
C
K
5
S
e
q
N
o
=
5
,
5
b
y
t
e
S
e
q
N
o
=
1
,
4
b
y
t
e
Typed
characters
Delayed ACK
Delayed ACK
A
C
K
1
0
Delayed ACK
46
TCP Flow Control
47
TCP Flow Control
▰ TCP uses a version of the sliding window
flow control, where
▻ Sending acknowledgements is separated
from setting the window size at sender
▻ Acknowledgements do not automatically
increase the window size
▰ During connection establishment, both ends of a
TCP connection set the initial size of the sliding
window
48
Window Management in TCP
▰ The receiver is returning two parameters to the sender
▰ The interpretation is:
▻ I am ready to receive new data with
SeqNo= AckNo, AckNo+1, …., AckNo+Win-1
▰ Receiver can acknowledge data without opening the
window
▰ Receiver can change the window size without
acknowledging data
AckNo
window size
(win)
32 bits 16 bits
49
Sliding Window Flow Control
1 2 3 4 5 6 7 8 9 10 11
Advertised window
sent but not
acknowledged can be sent
USABLE
WINDOW
sent and
acknowledged
can't sent
• Sliding Window Protocol is performed at the byte level:
•Here: Sender can transmit sequence numbers 6,7,8.
50
Sliding Window:
“Window Closes”
1 2 3 4 5 6 7 8 9 10 11
1 2 3 4 5 6 7 8 9 10 11
Transmit Byte 6
1 2 3 4 5 6 7 8 9 10 11
AckNo = 5, Win = 4
is received
• Transmission of a single byte (with SeqNo = 6) and acknowledgement is received
(AckNo = 5, Win=4):
51
Sliding Window:
“Window Opens”
1 2 3 4 5 6 7 8 9 10 11
1 2 3 4 5 6 7 8 9 10 11
AckNo = 5, Win = 6
is received
• Acknowledgement is received that enlarges the window to the right
(AckNo = 5, Win=6):
• A receiver opens a window when TCP buffer empties (meaning that data is
delivered to the application).
52
Sliding Window:
“Window Shrinks”
1 2 3 4 5 6 7 8 9 10 11
1 2 3 4 5 6 7 8 9 10 11
AckNo = 5, Win = 3
is received
• Acknowledgement is received that reduces the window from the right
(AckNo = 5, Win=3):
• Shrinking a window should not be used
53
Sliding Window: Example
3K
2K SeqNo=0
Receiver
Buffer
0 4K
Sender
sends 2K
of data
2K
AckNo=2048 Win=2048
Sender
sends 2K
of data 2K SeqNo=2048
4K
AckNo=4096 Win=0
AckNo=4096 Win=1024
Sender
blocked
TCP Error Control
55
Error Control in
TCP
▰ TCP maintains a Retransmission Timer for
each connection:
▻ The timer is started during a transmission. A timeout
causes a retransmission
▰ TCP couples error control and congestion
control (i.e., it assumes that errors are caused by
congestion)
▻ Retransmission mechanism is part of congestion
control algorithm
▰ Here: How to set the timeout value of the
retransmission timer?
56
TCP
Retransmission
Timer
▰ Retransmission Timer:
▻ The setting of the retransmission timer is crucial for
efficiency
▻ Timeout value too small  results in
unnecessary retransmissions
▻ Timeout value too large  long waiting time
before a retransmission
can be issued
▻ A problem is that the delays in the network are not
fixed
▻ Therefore, the retransmission timers must be adaptive
57
Round-Trip Time
Measurements
▰ The retransmission mechanism of TCP
is adaptive
▰ The retransmission timers are set based
on round-trip time (RTT)
measurements that TCP performs
RTT
#1
RTT
#2
RTT
#3
The RTT is based on time difference
between segment transmission and
ACK
But:
TCP does not ACK each segment
Each connection has only one
timer
58
Exponential Backoff
▰ Scenario: File transfer between two machines.
Disconnect cable.
▰ The interval between retransmission attempts
in seconds is:
1.03, 3, 6, 12, 24, 48, 64, 64, 64, 64, 64, 64, 64.
▰ Time between retrans-missions is doubled each
time (Exponential Backoff Algorithm)
▰ Timer is not increased beyond 64 seconds
▰ TCP gives up after 13th attempt and 9 minutes.
0
100
200
300
400
500
600
Seconds
0 2 4 6 8 10 12
Transmission Attempts
TCP Congestion Control
60
TCP Congestion
Control
▰ TCP has a mechanism for congestion control.
The mechanism is implemented at the sender
▰ The window size at the sender is set as follows:
Send Window = MIN (flow control window,
congestion window)
where
▻ flow control window is advertised by the receiver
▻ congestion window is adjusted based on feedback
from the network
61
TCP Congestion
Control
▰ TCP congestion control is governed by two
parameters:
▻ Congestion Window (cwnd)
▻ Slow-start threshhold Value (ssthresh)
Initial value is 216
-1
▰ Congestion control works in two modes:
▻ slow start (cwnd < ssthresh)
▻ congestion avoidance (cwnd ≥ ssthresh
62
Slow Start
▰ Initial value: Set cwnd = 1
▻ Note: Unit is a segment size. TCP actually is based on bytes and
increments by 1 MSS (maximum segment size)
▰ The receiver sends an acknowledgement (ACK) for each Segment
▻ Note: Generally, a TCP receiver sends an ACK for every other segment.
▰ Each time an ACK is received by the sender, the congestion
window is increased by 1 segment:
cwnd = cwnd + 1
▻ If an ACK acknowledges two segments, cwnd is still increased by only 1
segment.
▻ Even if ACK acknowledges a segment that is smaller than MSS bytes long, cwnd
is increased by 1.
▰ Does Slow Start increment slowly? Not really.
In fact, the increase of cwnd is exponential
63
Slow Start Example
▰ The congestion window size grows very
rapidly
▻ For every ACK, we increase cwnd by 1
irrespective of the number of
segments ACK’ed
▰ TCP slows down the increase of cwnd
when
cwnd > ssthresh
cwnd = 1
cwnd = 2
cwnd = 4
cwnd = 7
64
Congestion
Avoidance
▰ Congestion avoidance phase is started if
cwnd has reached the slow-start threshold
value
▰ If cwnd ≥ ssthresh then each time an ACK is
received, increment cwnd as follows:
▻ cwnd = cwnd + 1/ cwnd
▰ So cwnd is increased by one only if all cwnd
segments have been acknowledged.
65
Example of
Slow Start/Congestion
Avoidance
Assume that ssthresh = 8
cwnd = 1
cwnd = 2
cwnd = 4
cwnd = 8
cwnd = 9
cwnd = 10
0
2
4
6
8
10
12
14
Roundtrip times
Cwnd
(in
segments)
ssthresh
66
Responses to
Congestion
▰ So, TCP assumes there is congestion if it detects a
packet loss
▰ A TCP sender can detect lost packets via:
▻ Timeout of a retransmission timer
▻ Receipt of a duplicate ACK
▰ TCP interprets a Timeout as a binary congestion signal. When a
timeout occurs, the sender performs:
▻ cwnd is reset to one:
cwnd = 1
▻ ssthresh is set to half the current size of the congestion window:
ssthressh = cwnd / 2
▻ and slow-start is entered
Summary of TCP
congestion control
Initially:
cwnd = 1;
ssthresh =
advertised window size;
New Ack received:
if (cwnd < ssthresh)
/* Slow Start*/
cwnd = cwnd + 1;
else
/* Congestion Avoidance */
cwnd = cwnd + 1/cwnd;
Timeout:
/* Multiplicative decrease */
ssthresh = cwnd/2;
cwnd = 1;
68
Slow Start /
Congestion Avoidance
▰ A typical plot of cwnd for a TCP
connection (MSS = 1500 bytes) with TCP
Tahoe:
69
Flavors of TCP
Congestion Control
▰ TCP Tahoe (1988, FreeBSD 4.3 Tahoe)
▻ Slow Start
▻ Congestion Avoidance
▻ Fast Retransmit
▰ TCP Reno (1990, FreeBSD 4.3 Reno)
▻ Fast Recovery
▰ New Reno (1996)
▰ SACK (1996)
▰ RED (Floyd and Jacobson 1993)
70
TCP Reno
• Duplicate ACKs:
• Fast retransmit
• Fast recovery
 Fast Recovery avoids slow start
• Timeout:
• Retransmit
• Slow Start
• TCP Reno improves upon TCP Tahoe when a single packet is
dropped in a round-trip time.
71
TCP Tahoe and TCP
Reno
(for single segment
losses)
Reno time
cwnd
time
cwnd
Taho
72
TCP New Reno
• When multiple packets are dropped, Reno has problems
• Partial ACK:
– Occurs when multiple packets are lost
– A partial ACK acknowledges some, but not all packets that are
outstanding at the start of a fast recovery, takes sender out of fast
recovery
Sender has to wait until timeout occurs
• New Reno:
– Partial ACK does not take sender out of fast recovery
– Partial ACK causes retransmission of the segment
following the acknowledged segment
• New Reno can deal with multiple lost segments without going to slow
start
73
SACK
▰ SACK = Selective acknowledgment
▰ Issue: Reno and New Reno retransmit at most 1 lost packet per
round trip time
▰ Selective acknowledgments: The receiver can acknowledge
non-continuous blocks of data (SACK 0-1023, 1024-2047)
▰ Multiple blocks can be sent in a single segment.
▰ TCP SACK:
▻ Enters fast recovery upon 3 duplicate ACKs
▻ Sender keeps track of SACKs and infers if segments are lost.
Sender retransmits the next segment from the list of segments
that are deemed lost.
Ad

More Related Content

Similar to Transmission Control Protocol (TCP) connection oriented (20)

W14-15L28-29 Process to Process Communication.ppt
W14-15L28-29 Process to Process Communication.pptW14-15L28-29 Process to Process Communication.ppt
W14-15L28-29 Process to Process Communication.ppt
eagledevil137
 
TCP/IP
TCP/IPTCP/IP
TCP/IP
Anju Kanjirathingal
 
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
ZahouAmel1
 
Unit V computer network notes for study.
Unit V computer network notes for study.Unit V computer network notes for study.
Unit V computer network notes for study.
SahilSukhdeve2
 
Chapter 01 - Overview
Chapter 01 - OverviewChapter 01 - Overview
Chapter 01 - Overview
phanleson
 
Unit_3_TCP_UDP.ppt
Unit_3_TCP_UDP.pptUnit_3_TCP_UDP.ppt
Unit_3_TCP_UDP.ppt
zmulani8
 
Transport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptxTransport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptx
AnkitKumar891632
 
Osi model
Osi modelOsi model
Osi model
Anuj Kumar
 
Transmission control protocol tcp tcp tcp tcp
Transmission control protocol tcp tcp tcp tcpTransmission control protocol tcp tcp tcp tcp
Transmission control protocol tcp tcp tcp tcp
DeepaThilakK
 
Week8 lec1-bscs1
Week8 lec1-bscs1Week8 lec1-bscs1
Week8 lec1-bscs1
syedhaiderraza
 
Networking essentials lect3
Networking essentials lect3Networking essentials lect3
Networking essentials lect3
Roman Brovko
 
tcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptxtcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptx
AlphaKoiSylvester
 
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)
Hamidreza Bolhasani
 
T Tcp
T TcpT Tcp
T Tcp
Ram Dutt Shukla
 
TCP - IP Presentation
TCP - IP PresentationTCP - IP Presentation
TCP - IP Presentation
Harish Chand
 
Tcp ip presentation
Tcp ip presentationTcp ip presentation
Tcp ip presentation
Satya P. Joshi
 
Tcp3 wayhandshakeprocess
Tcp3 wayhandshakeprocessTcp3 wayhandshakeprocess
Tcp3 wayhandshakeprocess
Aashutoshkumar28
 
Transport Layer
Transport LayerTransport Layer
Transport Layer
Ram Dutt Shukla
 
Transport Layer [Autosaved]
Transport Layer [Autosaved]Transport Layer [Autosaved]
Transport Layer [Autosaved]
Ram Dutt Shukla
 
Week5 lec3-bscs1
Week5 lec3-bscs1Week5 lec3-bscs1
Week5 lec3-bscs1
syedhaiderraza
 
W14-15L28-29 Process to Process Communication.ppt
W14-15L28-29 Process to Process Communication.pptW14-15L28-29 Process to Process Communication.ppt
W14-15L28-29 Process to Process Communication.ppt
eagledevil137
 
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols5-LEC- 5.pptxTransport Layer.  Transport Layer Protocols
5-LEC- 5.pptxTransport Layer. Transport Layer Protocols
ZahouAmel1
 
Unit V computer network notes for study.
Unit V computer network notes for study.Unit V computer network notes for study.
Unit V computer network notes for study.
SahilSukhdeve2
 
Chapter 01 - Overview
Chapter 01 - OverviewChapter 01 - Overview
Chapter 01 - Overview
phanleson
 
Unit_3_TCP_UDP.ppt
Unit_3_TCP_UDP.pptUnit_3_TCP_UDP.ppt
Unit_3_TCP_UDP.ppt
zmulani8
 
Transport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptxTransport_Layer_Protocols.pptx
Transport_Layer_Protocols.pptx
AnkitKumar891632
 
Transmission control protocol tcp tcp tcp tcp
Transmission control protocol tcp tcp tcp tcpTransmission control protocol tcp tcp tcp tcp
Transmission control protocol tcp tcp tcp tcp
DeepaThilakK
 
Networking essentials lect3
Networking essentials lect3Networking essentials lect3
Networking essentials lect3
Roman Brovko
 
tcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptxtcp-ippresentation-150614172243-lva1-app6892.pptx
tcp-ippresentation-150614172243-lva1-app6892.pptx
AlphaKoiSylvester
 
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)
Hamidreza Bolhasani
 
TCP - IP Presentation
TCP - IP PresentationTCP - IP Presentation
TCP - IP Presentation
Harish Chand
 
Transport Layer [Autosaved]
Transport Layer [Autosaved]Transport Layer [Autosaved]
Transport Layer [Autosaved]
Ram Dutt Shukla
 

Recently uploaded (20)

Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...
Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...
Optimizing Reinforced Concrete Cantilever Retaining Walls Using Gases Brownia...
Journal of Soft Computing in Civil Engineering
 
IPC-7711D-7721D_ EN 2023 TOC Rework, Modification and Repair of Electronic As...
IPC-7711D-7721D_ EN 2023 TOC Rework, Modification and Repair of Electronic As...IPC-7711D-7721D_ EN 2023 TOC Rework, Modification and Repair of Electronic As...
IPC-7711D-7721D_ EN 2023 TOC Rework, Modification and Repair of Electronic As...
ssuserd9338b
 
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
Jimmy Lai
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
Zeiss-Ultra-Optimeter metrology subject.pdf
Zeiss-Ultra-Optimeter metrology subject.pdfZeiss-Ultra-Optimeter metrology subject.pdf
Zeiss-Ultra-Optimeter metrology subject.pdf
Saikumar174642
 
VISHAL KUMAR SINGH Latest Resume with updated details
VISHAL KUMAR SINGH Latest Resume with updated detailsVISHAL KUMAR SINGH Latest Resume with updated details
VISHAL KUMAR SINGH Latest Resume with updated details
Vishal Kumar Singh
 
🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
SanjeetMishra29
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Environment .................................
Environment .................................Environment .................................
Environment .................................
shadyozq9
 
Introduction to Additive Manufacturing(3D printing)
Introduction to Additive Manufacturing(3D printing)Introduction to Additive Manufacturing(3D printing)
Introduction to Additive Manufacturing(3D printing)
vijimech408
 
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
ijdmsjournal
 
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control Monthly May 2025
Water Industry Process Automation & Control
 
David Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And PythonDavid Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And Python
David Boutry
 
698642933-DdocfordownloadEEP-FAKE-PPT.pptx
698642933-DdocfordownloadEEP-FAKE-PPT.pptx698642933-DdocfordownloadEEP-FAKE-PPT.pptx
698642933-DdocfordownloadEEP-FAKE-PPT.pptx
speedcomcyber25
 
22PCOAM16_MACHINE_LEARNING_UNIT_IV_NOTES_with_QB
22PCOAM16_MACHINE_LEARNING_UNIT_IV_NOTES_with_QB22PCOAM16_MACHINE_LEARNING_UNIT_IV_NOTES_with_QB
22PCOAM16_MACHINE_LEARNING_UNIT_IV_NOTES_with_QB
Guru Nanak Technical Institutions
 
AI-Powered Data Management and Governance in Retail
AI-Powered Data Management and Governance in RetailAI-Powered Data Management and Governance in Retail
AI-Powered Data Management and Governance in Retail
IJDKP
 
Urban Transport Infrastructure September 2023
Urban Transport Infrastructure September 2023Urban Transport Infrastructure September 2023
Urban Transport Infrastructure September 2023
Rajesh Prasad
 
22PCOAM16 Unit 3 Session 23 Different ways to Combine Classifiers.pptx
22PCOAM16 Unit 3 Session 23  Different ways to Combine Classifiers.pptx22PCOAM16 Unit 3 Session 23  Different ways to Combine Classifiers.pptx
22PCOAM16 Unit 3 Session 23 Different ways to Combine Classifiers.pptx
Guru Nanak Technical Institutions
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
IPC-7711D-7721D_ EN 2023 TOC Rework, Modification and Repair of Electronic As...
IPC-7711D-7721D_ EN 2023 TOC Rework, Modification and Repair of Electronic As...IPC-7711D-7721D_ EN 2023 TOC Rework, Modification and Repair of Electronic As...
IPC-7711D-7721D_ EN 2023 TOC Rework, Modification and Repair of Electronic As...
ssuserd9338b
 
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
[PyCon US 2025] Scaling the Mountain_ A Framework for Tackling Large-Scale Te...
Jimmy Lai
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
Zeiss-Ultra-Optimeter metrology subject.pdf
Zeiss-Ultra-Optimeter metrology subject.pdfZeiss-Ultra-Optimeter metrology subject.pdf
Zeiss-Ultra-Optimeter metrology subject.pdf
Saikumar174642
 
VISHAL KUMAR SINGH Latest Resume with updated details
VISHAL KUMAR SINGH Latest Resume with updated detailsVISHAL KUMAR SINGH Latest Resume with updated details
VISHAL KUMAR SINGH Latest Resume with updated details
Vishal Kumar Singh
 
🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
🚀 TDX Bengaluru 2025 Unwrapped: Key Highlights, Innovations & Trailblazer Tak...
SanjeetMishra29
 
Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025Transport modelling at SBB, presentation at EPFL in 2025
Transport modelling at SBB, presentation at EPFL in 2025
Antonin Danalet
 
Environment .................................
Environment .................................Environment .................................
Environment .................................
shadyozq9
 
Introduction to Additive Manufacturing(3D printing)
Introduction to Additive Manufacturing(3D printing)Introduction to Additive Manufacturing(3D printing)
Introduction to Additive Manufacturing(3D printing)
vijimech408
 
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
OPTIMIZING DATA INTEROPERABILITY IN AGILE ORGANIZATIONS: INTEGRATING NONAKA’S...
ijdmsjournal
 
David Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And PythonDavid Boutry - Specializes In AWS, Microservices And Python
David Boutry - Specializes In AWS, Microservices And Python
David Boutry
 
698642933-DdocfordownloadEEP-FAKE-PPT.pptx
698642933-DdocfordownloadEEP-FAKE-PPT.pptx698642933-DdocfordownloadEEP-FAKE-PPT.pptx
698642933-DdocfordownloadEEP-FAKE-PPT.pptx
speedcomcyber25
 
AI-Powered Data Management and Governance in Retail
AI-Powered Data Management and Governance in RetailAI-Powered Data Management and Governance in Retail
AI-Powered Data Management and Governance in Retail
IJDKP
 
Urban Transport Infrastructure September 2023
Urban Transport Infrastructure September 2023Urban Transport Infrastructure September 2023
Urban Transport Infrastructure September 2023
Rajesh Prasad
 
22PCOAM16 Unit 3 Session 23 Different ways to Combine Classifiers.pptx
22PCOAM16 Unit 3 Session 23  Different ways to Combine Classifiers.pptx22PCOAM16 Unit 3 Session 23  Different ways to Combine Classifiers.pptx
22PCOAM16 Unit 3 Session 23 Different ways to Combine Classifiers.pptx
Guru Nanak Technical Institutions
 
Agents chapter of Artificial intelligence
Agents chapter of Artificial intelligenceAgents chapter of Artificial intelligence
Agents chapter of Artificial intelligence
DebdeepMukherjee9
 
Ad

Transmission Control Protocol (TCP) connection oriented

  • 1. ​ JIMS Engineering Management Technical Campus 48/4, Knowledge park-III,Greater Noida, UP-201306 (Affiliated to Guru Gobind Singh Indraprastha University, New Delhi) Subject Name: Computer Networks Subject Code: ETCS-306 Department of CSE
  • 2. Subject: Computer Networks Topic: Transmission Control Protocol
  • 3. 3 Overview TCP = Transmission Control Protocol ▰ Connection-oriented protocol ▰ Provides a reliable unicast end-to-end byte stream over an unreliable internetwork. TCP IP Internetwork Byte Stream Byte Stream TCP
  • 4. 4 Connection-Oriented ▰ Before any data transfer, TCP establishes a connection: ▻ One TCP entity is waiting for a connection (“server”) ▻ The other TCP entity (“client”) contacts the server ▰ The actual procedure for setting up connections is more complex. ▰ Each connection is full duplex CLIENT SERVER waiting for connection request Request a connection Accept a connection Disconnect Data Transer
  • 5. 5 Reliable • Byte stream is broken up into chunks which are called seg-ments • Receiver sends acknowledgements (ACKs) for segments • TCP maintains a timer. If an ACK is not received in time, the segment is retransmitted •Detecting errors: • TCP has checksums for header and data. Segments with invalid checksums are discarded • Each byte that is transmitted has a sequence number
  • 6. 6 Byte Stream Service ▰ To the lower layers, TCP handles data in blocks, the segments. ▰ To the higher layers TCP handles data as a sequence of bytes and does not identify boundaries between bytes ▰ So: Higher layers do not know about the beginning and end of segments ! TCP Application 1. write 100 bytes 2. write 20 bytes queue of bytes to be transmitted TCP queue of bytes that have been received Application 1. read 40 bytes 2. read 40 bytes 3. read 40 bytes Segments
  • 7. 7 TCP Format IP header TCP header TCP data Sequence number (32 bits) DATA 20 bytes 20 bytes 0 15 16 31 Source Port Number Destination Port Number Acknowledgement number (32 bits) window size header length 0 Flags Options (if any) TCP checksum urgent pointer 20 bytes • TCP segments have a 20 byte header with >= 0 bytes of data.
  • 8. 8 TCP header fields ▰ Port Number: ▻ A port number identifies the endpoint of a connection. ▻ A pair <IP address, port number> identifies one endpoint of a connection. ▻ Two pairs <client IP address, client port number> and <server IP address, server port number> identify a TCP connection. TCP IP Applications 23 104 80 Ports: TCP IP Applications 7 16 80 Ports:
  • 9. 9 TCP header fields 9 Sequence Number (SeqNo):  Sequence number is 32 bits long.  So the range of SeqNo is 0 <= SeqNo <= 232 -1  4.3 Gbyte  TCP uses sequence numbers to keep track of transmitted and acknowledged data  Each transmitted byte of payload data is associated with a sequence number  Sequence numbers count bytes and not segments  Sequence number of first byte in payload is written in SeqNo field  The sequence number of the first sequence number (Initial sequence number) is negotiated during connection setup Sequence number (SeqNo) (32 bits) Source Port Number Destination Port Number Acknowledgement number (AckNo)(32 bits) window size header length 0 Flags TCP checksum urgent pointer
  • 10. TCP header fields  An acknowledgment is a confirmation of delivery of data  When a TCP receiver wants to acknowledge data, it  writes a sequence number in the AckNo field, and  sets the ACK flag IMPORTANT: An acknowledgment confirms receipt for all unacknowledged data that has a smaller sequence number than given in the AckNo field Example: AckNo=5 confirms delivery for 1,2,3,4 (but not 5). Sequence number (SeqNo) (32 bits) Source Port Number Destination Port Number Acknowledgement number (AckNo)(32 bits) window size header length 0 Flags TCP checksum urgent pointer
  • 11. 11 TCP header fields: ▰ Header Length ( 4bits): ▻ TCP header has variable length (with minimum 20 bytes) ▰ Flag bits ▻ URG: Urgent pointer is valid ▻ If the bit is set, the following bytes contain an urgent message in the range: SeqNo <= urgent message <= SeqNo+urgent pointer ▻ ACK: Acknowledgement Number is valid ▻ PSH: PUSH Flag ▻ Notification from sender to the receiver that the receiver should pass all data that it has to the application. ▻ RST: Reset the connection ▻ The flag causes the receiver to reset the connection ▻ SYN: Synchronize sequence numbers ▻ Sent in the first packet when initiating a connection ▻ FIN: Sender is finished with sending ▻ Used for closing a connection ▻ Both sides of a connection must send a FIN
  • 12. 12 TCP header fields ▰ Window Size: ▻ Each side of the connection advertises the window size ▻ Window size is the maximum number of bytes that a receiver can accept. ▻ Maximum window size is 216 -1= 65535 bytes ▰ TCP Checksum: ▻ TCP checksum covers over both TCP header and TCP data (also covers some parts of the IP header) ▰ Urgent Pointer: ▻ Only valid if URG flag is set ▰ Options: field provides a way to add extra facilities not covered by the regular header.
  • 13. The TCP Service Model Some assigned ports. Port Protocol Use 21 FTP File transfer 23 Telnet Remote login 25 SMTP E-mail 69 TFTP Trivial File Transfer Protocol 79 Finger Lookup info about a user 80 HTTP World Wide Web 110 POP-3 Remote e-mail access
  • 16. 16 ▰ Opening a TCP Connection ▰ Closing a TCP Connection ▰ Special Scenarios ▰ State Diagram
  • 17. 17 TCP Connection Establishment ▰ TCP uses a three-way handshake to open a connection: (1) ACTIVE OPEN: Client sends a segment with ▻ SYN bit set * ▻ port number of client ▻ initial sequence number (ISN) of client (2) PASSIVE OPEN: Server responds with a segment with ▻ SYN bit set * ▻ initial sequence number of server ▻ ACK for ISN of client (3) Client acknowledges by sending a segment with: ▻ ACK ISN of server (* counts as one byte)
  • 18. Three-Way Handshake (a) TCP connection establishment in the normal case. (b) Call collision. 6-31
  • 19. 19 A Closer Look with tcpdump 1 aida.poly.edu.1121 > mng.poly.edu.telnet: S 1031880193:1031880193(0) win 16384 <mss 1460,nop,wscale 0,nop,nop,timestamp> 2 mng.poly.edu.telnet > aida.poly.edu.1121: S 172488586:172488586(0) ack 1031880194 win 8760 <mss 1460> 3 aida.poly.edu.1121 > mng.poly.edu.telnet: . ack 172488587 win 17520 4 aida.poly.edu.1121 > mng.poly.edu.telnet: P 1031880194:1031880218(24) ack 172488587 win 17520 5 mng.poly.edu.telnet > aida.poly.edu.1121: P 172488587:172488590(3) ack 1031880218 win 8736 6 aida.poly.edu.1121 > mng.poly.edu.telnet: P 1031880218:1031880221(3) ack 172488590 win 17520 aida.poly.edu mng.poly.edu aida issues an "telnet mng"
  • 20. 20 Three-Way Handshake aida.poly.edu mng.poly.edu S 1031880193:1031880193(0) win 16384 <mss 1460, ...> S 172488586:172488586(0) ack 1031880194 win 8760 <mss 1460> ack 172488587 win 17520
  • 21. Why is a Two-Way Handshake not enough? aida.poly.edu mng.poly.edu S 15322112354:15322112354(0) win 16384 <mss 1460, ...> S 172488586:172488586(0) win 8760 <mss 1460> S 1031880193:1031880193(0) win 16384 <mss 1460, ...> The red line is a delayed duplicate packet. When aida initiates the data transfer (starting with SeqNo=15322112355), mng will reject all data. Will be discarded as a duplicate SYN
  • 22. 22 TCP Connection Termination ▰ Each end of the data flow must be shut down independently (“half-close”) ▰ If one end is done it sends a FIN segment. This means that no more data will be sent ▰ Four steps involved: (1) X sends a FIN to Y (active close) (2) Y ACKs the FIN, (at this time: Y can still send data to X) (3) and Y sends a FIN to X (passive close) (4) X ACKs the FIN.
  • 23. 23 Connection termination with tcpdump 1 mng.poly.edu.telnet > aida.poly.edu.1121: F 172488734:172488734(0) ack 1031880221 win 8733 2 aida.poly.edu.1121 > mng.poly.edu.telnet: . ack 172488735 win 17484 3 aida.poly.edu.1121 > mng.poly.edu.telnet: F 1031880221:1031880221(0) ack 172488735 win 17520 4 mng.poly.edu.telnet > aida.poly.edu.1121: . ack 1031880222 win 8733 aida.poly.edu mng.poly.edu aida issues an "telnet mng"
  • 24. 24 TCP Connection Termination aida.poly.edu mng.poly.edu F 172488734:172488734(0) ack 1031880221 win 8733 . ack 172488735 win 17484 . ack 1031880222 win 8733 F 1031880221:1031880221(0) ack 172488735 win 17520
  • 25. 25 TCP States State Description CLOSED No connection is active or pending LISTEN The server is waiting for an incoming call SYN RCVD A connection request has arrived; wait for Ack SYN SENT The client has started to open a connection ESTABLISHED Normal data transfer state FIN WAIT 1 Client has said it is finished FIN WAIT 2 Server has agreed to release TIMED WAIT Wait for pending packets (“2MSL wait state”) CLOSING Both Sides have tried to close simultanesously CLOSE WAIT Server has initiated a release LAST ACK Wait for pending packets
  • 26. 26 TCP States in “Normal” Connection Lifetime SYN (SeqNo = x) SYN (SeqNo = y, AckNo = x + 1 ) (AckNo = y + 1 ) SYN_SENT (active open) SYN_RCVD ESTABLISHED ESTABLISHED FIN_WAIT_1 (active close) LISTEN (passive open) FIN (SeqNo = m) CLOSE_WAIT (passive close) (AckNo = m+ 1 ) FIN (SeqNo = n ) (AckNo = n+1) LAST_ACK FIN_WAIT_2 TIME_WAIT CLOSED
  • 27. 27 TCP State Transition Diagram Opening A Connection CLOSED LISTEN SYN RCVD SYN SENT ESTABLISHED active open send: SYN recv: SYN, ACK send: ACK recv: SYN send: SYN, ACK recvd: ACK send: . / . recv: RST Application sends data send: SYN simultaneous open recv: SYN send: SYN, ACK close or timeout passive open send: . / . recvd: FIN send: FIN send: FIN
  • 28. 28 TCP State Transition Diagram Closing A Connection FIN_WAIT_1 FIN_WAIT_2 ESTABLISHED recv: FIN send: ACK recv: ACK send: . / . recvd: ACK send: . / . recv: FIN, ACK send: ACK active close send: FIN TIME_WAIT CLOSING recv: FIN send: ACK CLOSED Timeout (2 MSL) CLOSE_WAIT LAST_ACK passive close recv: FIN send: ACK application closes send: FIN recv: ACK send: . / .
  • 29. 29 2MSL Wait State 2MSL Wait State = TIME_WAIT ▰ When TCP does an active close, and sends the final ACK, the connection must stay in in the TIME_WAIT state for twice the maximum segment lifetime. 2MSL= 2 * Maximum Segment Lifetime ▰ Why? TCP is given a chance to resent the final ACK. (Server will timeout after sending the FIN segment and resend the FIN) ▰ The MSL is set to 2 minutes or 1 minute or 30 seconds.
  • 30. 30 Resetting Connections ▰ Resetting connections is done by setting the RST flag ▰ When is the RST flag set? ▻ Connection request arrives and no server process is waiting on the destination port ▻ Abort (Terminate) a connection Causes the receiver to throw away buffered data. Receiver does not acknowledge the RST segment
  • 32. 32 What is Flow/Congestion/Error Control ? • Flow Control: Algorithms to prevent that the sender overruns the receiver with information • Error Control: Algorithms to recover or conceal the effects from packet losses • Congestion Control: Algorithms to prevent that the sender overloads the network  The goal of each of the control mechanisms are different.  In TCP, the implementation of these algorithms is combined
  • 33. 33 Acknowledgements in TCP ▰ TCP receivers use acknowledgments (ACKs) to confirm the receipt of data to the sender ▰ Acknowledgment can be added (“piggybacked”) to a data segment that carries data in the opposite direction ▰ ACK information is included in the the TCP header ▰ Acknowledgements are used for flow control, error control, and congestion control Data for B A B Data for A ACK ACK
  • 34. 34 Sequence Numbers and Acknowledgments in TCP ▰ TCP uses sequence numbers to keep track of transmitted and acknowledged data ▰ Each transmitted byte of payload data is associated with a sequence number ▰ Sequence numbers count bytes and not segments ▰ Sequence number of first byte in payload is written in SeqNo field ▰ Sequence numbers wrap when they reach 232 -1 ▰ The sequence number of the first sequence number (Initial sequence number) is negotiated during connection setup Sequence number (SeqNo) (32 bits) Source Port Number Destination Port Number Acknowledgement number (AckNo)(32 bits) window size header length 0 Flags TCP checksum urgent pointer
  • 35. 35 Sequence Numbers and Acknowledgments in TCP ▰ An acknowledgment is a confirmation of delivery of data ▰ When a TCP receiver wants to acknowledge data, it ▻ writes a sequence number in the AckNo field, and ▻ sets the ACK flag IMPORTANT: An acknowledgment confirms receipt for all unacknowledged data that has a smaller sequence number than given in the AckNo field Example: AckNo=5 confirms delivery for 1,2,3,4 (but not 5). Sequence number (SeqNo) (32 bits) Source Port Number Destination Port Number Acknowledgement number (AckNo)(32 bits) window size header length 0 Flags TCP checksum urgent pointer
  • 36. 36 Cumulative Acknowledgements ▰ TCP has cumulative acknowledgements: An acknowledgment confirms the receipt of all unacknowledged data with a smaller sequence number S e q N o = 0 1 0 b y t e s A B S e q N o = 1 0 1 0 b y t e s A C K 1 0 A C K 2 0 A C K 4 0 A C K 7 0 A C K 1 0 0 S e q N o = 2 0 1 0 b y t e s S e q N o = 3 0 1 0 b y t e s S e q N o = 4 0 1 0 b y t e s S e q N o = 5 0 1 0 b y t e s S e q N o = 6 0 1 0 b y t e s S e q N o = 7 0 1 0 b y t e s S e q N o = 8 0 1 0 b y t e s S e q N o = 9 0 1 0 b y t e s
  • 37. 37 Cumulative Acknowledgements ▰ With cumulative ACKs, the receiver can only acknowledge a segment if all previous segments have been received ▰ With cumulative ACKs, receiver cannot selectively acknowledge blocks of segments: e.g., ACK for S0-S3 and S5-S7 (but not for S4) ▰ Note: The use of cumulative ACKs imposes constraints on the retransmission schemes: ▻ In case of an error, the sender may need to retransmit all data that has not been acknowledged
  • 38. 38 Rules for sending Acknowledgments ▰ TCP has rules that influence the transmission of acknowledgments ▰ Rule 1: Delayed Acknowledgments ▻ Goal: Avoid sending ACK segments that do not carry data ▻ Implementation: Delay the transmission of (some) ACKs ▰ Rule 2: Nagle’s rule ▻ Goal: Reduce transmission of small segments Implementation: A sender cannot send multiple segments with a 1-byte payload (i.e., it must wait for an ACK)
  • 39. 39 Observing Delayed Acknowledgements • Remote terminal applications (e.g., Telnet) send characters to a server. The server interprets the character and sends the output at the server to the client. • For each character typed, you see three packets: 1. Client  Server: Send typed character 2. Server  Client: Echo of character (or user output) and acknowledgement for first packet 3. Client  Server: Acknowledgement for second packet 1. send character 2. interpret character 3. send echo of character and/or output Host with Telnet client Host with Telnet server
  • 40. 40 Observing Delayed Acknowledgements ▰ This is the output of typing 3 (three) characters : Time 44.062449: Argon  Neon: Push, SeqNo 0:1(1), AckNo 1 Time 44.063317: Neon  Argon: Push, SeqNo 1:2(1), AckNo 1 Time 44.182705: Argon  Neon: No Data, AckNo 2 Time 48.946471: Argon  Neon: Push, SeqNo 1:2(1), AckNo 2 Time 48.947326: Neon  Argon: Push, SeqNo 2:3(1), AckNo 2 Time 48.982786: Argon  Neon: No Data, AckNo 3 Time 55.116581: Argon  Neon: Push, SeqNo 2:3(1) AckNo 3 Time 55.117497: Neon  Argon: Push, SeqNo 3:4(1) AckNo 3 Time 55.183694: Argon  Neon: No Data, AckNo 4 Argon Neon Telnet session from Argon to Neon
  • 41. 41 Why 3 segments per character? ▰ We would expect four segments per character: ▰ But we only see three segments per character: ▰ This is due to delayed acknowledgements character ACK of character ACK of echoed character echo of character character ACK and echo of character ACK of echoed character
  • 42. 42 Delayed Acknowledgement ▰ TCP delays transmission of ACKs for up to 200ms ▰ Goal: Avoid to send ACK packets that do not carry data. ▻ The hope is that, within the delay, the receiver will have data ready to be sent to the receiver. Then, the ACK can be piggybacked with a data segment In Example: ▻ Delayed ACK explains why the “ACK of character” and the “echo of character” are sent in the same segment ▻ The duration of delayed ACKs can be observed in the example when Argon sends ACKs Exceptions: ▰ ACK should be sent for every second full sized segment ▰ Delayed ACK is not used when packets arrive out of order
  • 43. ▰ Because of delayed ACKs, an ACK is often observed for every other segment Delayed Acknowledgement S e q N o = 0 1 0 b y t e s A B S e q N o = 1 0 1 0 b y t e s A C K 2 0 A C K 4 0 A C K 5 0 A C K 9 0 S e q N o = 2 0 1 0 b y t e s S e q N o = 3 0 1 0 b y t e s S e q N o = 4 0 1 0 b y t e s S e q N o = 5 0 1 0 b y t e s S e q N o = 6 0 1 0 b y t e s S e q N o = 7 0 1 0 b y t e s S e q N o = 8 0 1 0 b y t e s Max. Delay for an ACK A C K 7 0
  • 44. 44 Observing Nagle’s Rule ▰ Observations: ▻ Argon never has multiple unacknowledged segments outstanding ▻ There are fewer transmissions than there are characters. ▰ This is due to Nagle’s Rule: ▻ Each TCP connection can have only one small (1-byte) segment outstanding that has not been acknowledged ▰ Implementation: Send one byte and buffer all subsequent bytes until acknowledgement is received. Then send all buffered bytes in a single segment. (Only enforced if byte is arriving from application one byte at a time). ▰ Goal of Nagle’s Rule: Reduce the amount of small segments. ▰ The algorithm can be disabled.
  • 45. 45 ▰ Only one 1-byte segment can be in transmission (Here: Since no data is sent from B to A, we also see delayed ACKs) Nagle’s Rule A C K 1 S e q N o = 0 , 1 b y t e A B A C K 5 S e q N o = 5 , 5 b y t e S e q N o = 1 , 4 b y t e Typed characters Delayed ACK Delayed ACK A C K 1 0 Delayed ACK
  • 47. 47 TCP Flow Control ▰ TCP uses a version of the sliding window flow control, where ▻ Sending acknowledgements is separated from setting the window size at sender ▻ Acknowledgements do not automatically increase the window size ▰ During connection establishment, both ends of a TCP connection set the initial size of the sliding window
  • 48. 48 Window Management in TCP ▰ The receiver is returning two parameters to the sender ▰ The interpretation is: ▻ I am ready to receive new data with SeqNo= AckNo, AckNo+1, …., AckNo+Win-1 ▰ Receiver can acknowledge data without opening the window ▰ Receiver can change the window size without acknowledging data AckNo window size (win) 32 bits 16 bits
  • 49. 49 Sliding Window Flow Control 1 2 3 4 5 6 7 8 9 10 11 Advertised window sent but not acknowledged can be sent USABLE WINDOW sent and acknowledged can't sent • Sliding Window Protocol is performed at the byte level: •Here: Sender can transmit sequence numbers 6,7,8.
  • 50. 50 Sliding Window: “Window Closes” 1 2 3 4 5 6 7 8 9 10 11 1 2 3 4 5 6 7 8 9 10 11 Transmit Byte 6 1 2 3 4 5 6 7 8 9 10 11 AckNo = 5, Win = 4 is received • Transmission of a single byte (with SeqNo = 6) and acknowledgement is received (AckNo = 5, Win=4):
  • 51. 51 Sliding Window: “Window Opens” 1 2 3 4 5 6 7 8 9 10 11 1 2 3 4 5 6 7 8 9 10 11 AckNo = 5, Win = 6 is received • Acknowledgement is received that enlarges the window to the right (AckNo = 5, Win=6): • A receiver opens a window when TCP buffer empties (meaning that data is delivered to the application).
  • 52. 52 Sliding Window: “Window Shrinks” 1 2 3 4 5 6 7 8 9 10 11 1 2 3 4 5 6 7 8 9 10 11 AckNo = 5, Win = 3 is received • Acknowledgement is received that reduces the window from the right (AckNo = 5, Win=3): • Shrinking a window should not be used
  • 53. 53 Sliding Window: Example 3K 2K SeqNo=0 Receiver Buffer 0 4K Sender sends 2K of data 2K AckNo=2048 Win=2048 Sender sends 2K of data 2K SeqNo=2048 4K AckNo=4096 Win=0 AckNo=4096 Win=1024 Sender blocked
  • 55. 55 Error Control in TCP ▰ TCP maintains a Retransmission Timer for each connection: ▻ The timer is started during a transmission. A timeout causes a retransmission ▰ TCP couples error control and congestion control (i.e., it assumes that errors are caused by congestion) ▻ Retransmission mechanism is part of congestion control algorithm ▰ Here: How to set the timeout value of the retransmission timer?
  • 56. 56 TCP Retransmission Timer ▰ Retransmission Timer: ▻ The setting of the retransmission timer is crucial for efficiency ▻ Timeout value too small  results in unnecessary retransmissions ▻ Timeout value too large  long waiting time before a retransmission can be issued ▻ A problem is that the delays in the network are not fixed ▻ Therefore, the retransmission timers must be adaptive
  • 57. 57 Round-Trip Time Measurements ▰ The retransmission mechanism of TCP is adaptive ▰ The retransmission timers are set based on round-trip time (RTT) measurements that TCP performs RTT #1 RTT #2 RTT #3 The RTT is based on time difference between segment transmission and ACK But: TCP does not ACK each segment Each connection has only one timer
  • 58. 58 Exponential Backoff ▰ Scenario: File transfer between two machines. Disconnect cable. ▰ The interval between retransmission attempts in seconds is: 1.03, 3, 6, 12, 24, 48, 64, 64, 64, 64, 64, 64, 64. ▰ Time between retrans-missions is doubled each time (Exponential Backoff Algorithm) ▰ Timer is not increased beyond 64 seconds ▰ TCP gives up after 13th attempt and 9 minutes. 0 100 200 300 400 500 600 Seconds 0 2 4 6 8 10 12 Transmission Attempts
  • 60. 60 TCP Congestion Control ▰ TCP has a mechanism for congestion control. The mechanism is implemented at the sender ▰ The window size at the sender is set as follows: Send Window = MIN (flow control window, congestion window) where ▻ flow control window is advertised by the receiver ▻ congestion window is adjusted based on feedback from the network
  • 61. 61 TCP Congestion Control ▰ TCP congestion control is governed by two parameters: ▻ Congestion Window (cwnd) ▻ Slow-start threshhold Value (ssthresh) Initial value is 216 -1 ▰ Congestion control works in two modes: ▻ slow start (cwnd < ssthresh) ▻ congestion avoidance (cwnd ≥ ssthresh
  • 62. 62 Slow Start ▰ Initial value: Set cwnd = 1 ▻ Note: Unit is a segment size. TCP actually is based on bytes and increments by 1 MSS (maximum segment size) ▰ The receiver sends an acknowledgement (ACK) for each Segment ▻ Note: Generally, a TCP receiver sends an ACK for every other segment. ▰ Each time an ACK is received by the sender, the congestion window is increased by 1 segment: cwnd = cwnd + 1 ▻ If an ACK acknowledges two segments, cwnd is still increased by only 1 segment. ▻ Even if ACK acknowledges a segment that is smaller than MSS bytes long, cwnd is increased by 1. ▰ Does Slow Start increment slowly? Not really. In fact, the increase of cwnd is exponential
  • 63. 63 Slow Start Example ▰ The congestion window size grows very rapidly ▻ For every ACK, we increase cwnd by 1 irrespective of the number of segments ACK’ed ▰ TCP slows down the increase of cwnd when cwnd > ssthresh cwnd = 1 cwnd = 2 cwnd = 4 cwnd = 7
  • 64. 64 Congestion Avoidance ▰ Congestion avoidance phase is started if cwnd has reached the slow-start threshold value ▰ If cwnd ≥ ssthresh then each time an ACK is received, increment cwnd as follows: ▻ cwnd = cwnd + 1/ cwnd ▰ So cwnd is increased by one only if all cwnd segments have been acknowledged.
  • 65. 65 Example of Slow Start/Congestion Avoidance Assume that ssthresh = 8 cwnd = 1 cwnd = 2 cwnd = 4 cwnd = 8 cwnd = 9 cwnd = 10 0 2 4 6 8 10 12 14 Roundtrip times Cwnd (in segments) ssthresh
  • 66. 66 Responses to Congestion ▰ So, TCP assumes there is congestion if it detects a packet loss ▰ A TCP sender can detect lost packets via: ▻ Timeout of a retransmission timer ▻ Receipt of a duplicate ACK ▰ TCP interprets a Timeout as a binary congestion signal. When a timeout occurs, the sender performs: ▻ cwnd is reset to one: cwnd = 1 ▻ ssthresh is set to half the current size of the congestion window: ssthressh = cwnd / 2 ▻ and slow-start is entered
  • 67. Summary of TCP congestion control Initially: cwnd = 1; ssthresh = advertised window size; New Ack received: if (cwnd < ssthresh) /* Slow Start*/ cwnd = cwnd + 1; else /* Congestion Avoidance */ cwnd = cwnd + 1/cwnd; Timeout: /* Multiplicative decrease */ ssthresh = cwnd/2; cwnd = 1;
  • 68. 68 Slow Start / Congestion Avoidance ▰ A typical plot of cwnd for a TCP connection (MSS = 1500 bytes) with TCP Tahoe:
  • 69. 69 Flavors of TCP Congestion Control ▰ TCP Tahoe (1988, FreeBSD 4.3 Tahoe) ▻ Slow Start ▻ Congestion Avoidance ▻ Fast Retransmit ▰ TCP Reno (1990, FreeBSD 4.3 Reno) ▻ Fast Recovery ▰ New Reno (1996) ▰ SACK (1996) ▰ RED (Floyd and Jacobson 1993)
  • 70. 70 TCP Reno • Duplicate ACKs: • Fast retransmit • Fast recovery  Fast Recovery avoids slow start • Timeout: • Retransmit • Slow Start • TCP Reno improves upon TCP Tahoe when a single packet is dropped in a round-trip time.
  • 71. 71 TCP Tahoe and TCP Reno (for single segment losses) Reno time cwnd time cwnd Taho
  • 72. 72 TCP New Reno • When multiple packets are dropped, Reno has problems • Partial ACK: – Occurs when multiple packets are lost – A partial ACK acknowledges some, but not all packets that are outstanding at the start of a fast recovery, takes sender out of fast recovery Sender has to wait until timeout occurs • New Reno: – Partial ACK does not take sender out of fast recovery – Partial ACK causes retransmission of the segment following the acknowledged segment • New Reno can deal with multiple lost segments without going to slow start
  • 73. 73 SACK ▰ SACK = Selective acknowledgment ▰ Issue: Reno and New Reno retransmit at most 1 lost packet per round trip time ▰ Selective acknowledgments: The receiver can acknowledge non-continuous blocks of data (SACK 0-1023, 1024-2047) ▰ Multiple blocks can be sent in a single segment. ▰ TCP SACK: ▻ Enters fast recovery upon 3 duplicate ACKs ▻ Sender keeps track of SACKs and infers if segments are lost. Sender retransmits the next segment from the list of segments that are deemed lost.
  翻译: