Académique Documents
Professionnel Documents
Culture Documents
Transport Layer
Computer Networking: A
Top Down Approach
4th edition.
Jim Kurose, Keith Ross
Addison-Wesley, July
2007.
Last Lecture
Selective Repeat (SR)
TCP
Segment Structure
Sequence Numbers
Acknowledgements
Todays Lecture
TCP Reliable Delivery
Is TCP Go-Back N or Selective
Repeat?
source port #
dest port #
sequence number
acknowledgement number
head not
len used
UA P R S F Receive window
Urg data pointer
checksum
Used in
implementing
a reliable
data transfer
Used for
flow control
(10,010 to 11,009)
Segment 2 11,010
(11,010 to 12,009)
Segment 3 12,010
(12,010 to 13,009)
Segment 4 13,010
(13,010 to 14,009)
Segment 5 14,010
(14,010 to 16,009)
TCP ACKs
Acknowledgement Numbers:
Example
Host A receives all bytes numbered 0 through 535 from B
Host A puts 536 in the acknowledgment number field of the
segment it sends to B
TCP acknowledges bytes up to first missing bytes in the stream
Cumulative Acknowledgement
How receiver handles out-of-order segments?
TCP RFCs do not impose any rules
Two choices
o The receiver discards out of order segments
o Keeps out of order bytes and waits for missing bytes to fill
Host B
Host A
User
types
C
Seq=4
2, AC
K
C
79, A
=
q
e
S
host ACKs
receipt
of echoed
C
=79, d
K= 4
ata =
C
ta =
3, da
host ACKs
receipt of
C, echoes
back C
Piggybacked
Seq=4
3,
ACK=8
0
time
LastByteSent LastByteAcked
RcvWindow
Suppose RcvWindow=0
Timeout
Duplicate Acks ( will see shortly)
(2) Timeout:
Retransmit segment
Restart timer
(3)Ack Received:
If acknowledges previously
unACked segments
Update what is known
to be ACKed
Start timer if there
are outstanding
segments
NextSeqNum = InitialSeqNum
SendBase = InitialSeqNum
loop (forever) {
switch(event)
event: data received from application above
create TCP segment with sequence number NextSeqNum
if (timer currently not running)
start timer
pass segment to IP
NextSeqNum = NextSeqNum + length(data)
event: timer timeout
retransmit not-yet-acknowledged segment with
smallest sequence number
start timer
event: ACK received, with ACK field value of y
if (y > SendBase) {
SendBase = y
if (there are currently not-yet-acknowledged segments)
start timer
}
} /* end of loop forever */
TCP
Sender
(Simplified)
tes da
t
=100
K
C
A
loss
Seq=9
2, 8 b
y
tes da
t
=1 0 0
ACK
SendBase
= 100
time
Seq=92 timeout
timeout
Seq=9
2, 8 b
y
Seq=9
2, 8 b
ytes d
ata
Seq=
100,
20 by
tes d
ata
0
=10 120
K
AC ACK=
Seq=9
2, 8 b
y
Sendbase
= 100
SendBase
= 120
SendBase
= 120
Host B
Host A
Host B
tes da
t
20
K=1
C
A
time
Premature Timeout
timeout
Seq=9
2, 8 b
y
SendBase
= 120
Host B
tes da
t
= 1 00
Seq=1
K
C
A
00, 20
bytes
data
loss
=1 2 0
AC K
time
Cumulative ACK scenario
Fast Retransmit
Time-out period often
relatively long:
Host A
Host B
timeout
r es en
d 2 nd
segme
nt
time
Resending a Segment after Triple Duplicate ACK
Fast Retransmit
Selective Repeat
Buffering of out of order packets
TCP SACK (RFC 2018) allows to ACK out of order packets
selectively rather than cumulatively
Difference