Chapter3 Part2
Chapter3 Part2
Chapter3 Part2
Transport Layer3-3
TCP seq. numbers, ACKs
outgoing segment from sender
sequence numbers: source port # dest port #
sequence number
byte stream “number” acknowledgement number
rwnd
of first byte in checksum urg pointer
User
types
‘C’
Seq=42, ACK=79, data = ‘C’
host ACKs
receipt of
‘C’, echoes
Seq=79, ACK=43, data = ‘C’ back ‘C’
host ACKs
receipt
of echoed
‘C’ Seq=43, ACK=80
Transport Layer3-5
TCP reliable data transfer
TCP creates rdt
service on top of IP’s
unreliable service
pipelined segments let’s initially consider
cumulative acks simplified TCP
single retransmission sender:
timer ignore duplicate acks
retransmissions ignore flow control,
triggered by: congestion control
timeout events
duplicate acks
Transport Layer3-6
TCP sender events:
data rcvd from app: timeout:
create segment with retransmit segment
seq # that caused timeout
seq # is byte-stream restart timer
number of first data ack rcvd:
byte in segment if ack
start timer if not
acknowledges
already running previously unacked
think of timer as for segments
oldest unacked update what is
segment known to be ACKed
expiration interval: start timer if there
TimeOutInterval
are still unacked Transport Layer3-7
TCP: retransmission scenarios
Host A Host B Host A Host B
SendBase=92
Seq=92, 8 bytes of data Seq=92, 8 bytes of data
timeout
timeout
Seq=100, 20 bytes of data
ACK=100
X
ACK=100
ACK=120
SendBase=120
ACK=100
X
ACK=120
cumulative ACK
Transport Layer3-9
TCP ACK generation [RFC 1122, RFC 2581]
event at receiver TCP receiver action
arrival of in-order segment with delayed ACK. Wait up to 500ms
expected seq #. All data up to for next segment. If no next segment,
expected seq # already ACKed send ACK
Transport Layer3-10
TCP fast retransmit
time-out period
TCP fast retransmit
often relatively
long: if sender receives 3
ACKs for same data
long delay before
resending lost (“triple
(“triple duplicate
duplicate ACKs”),
ACKs”),
packet resend unacked
segment with smallest
detect lost seq #
segments via likely that unacked
duplicate ACKs. segment lost, so don’t
sender often sends wait for timeout
many segments
back-to-back
if segment is lost, Transport Layer3-11
TCP fast retransmit
Host A Host B
ACK=100
timeout
ACK=100
ACK=100
ACK=100
Seq=100, 20 bytes of data
Transport Layer3-13
TCP: closing a connection
client state server state
ESTAB ESTAB
clientSocket.close()
FIN_WAIT_1 can no longer FINbit=1, seq=x
send but can
receive data CLOSE_WAIT
ACKbit=1; ACKnum=x+1
can still
FIN_WAIT_2 wait for server send data
close
LAST_ACK
FINbit=1, seq=y
TIMED_WAIT can no longer
send data
ACKbit=1; ACKnum=y+1
timed wait
for 2*max CLOSED
segment lifetime
CLOSED
Transport Layer3-14