Transport Layer Updated 2023
Transport Layer Updated 2023
Transport Layer
lo
processes running on
gi
ca
different hosts
enl
transport protocols run in
d-
en
end systems
d
tr
send side: breaks app
a ns
po
messages into segments,
tr
passes to network layer applicatio
rcv side: reassembles n
transport
segments into messages, network
data link
passes to app layer physical
lo
data link
network
gi
physical
data link
ca
flow control physical
l en
connection setup
d-
en
unreliable, unordered network
d
data link
tr
a
physicalnetwork
delivery: UDP
ns
data link
po
physical
r
no-frills extension of
t
network
data link
applicatio
“best-effort” IP physical network
data link
n
transport
services not available: physical network
data link
physical
delay guarantees
bandwidth guarantees
P3 P1
P1 P2 P4 application
application application
host 2 host 3
host 1
Transport Layer 3-8
How demultiplexing works
host receives IP datagrams
each datagram has source IP
address, destination IP address 32 bits
each datagram carries 1
source port # dest port #
transport-layer segment
each segment has source,
destination port number other header fields
host uses IP addresses & port
numbers to direct segment to
appropriate socket
application
data
(message)
P2 P1
P1
P3
P1 P4 P5 P6 P2 P1P3
SP: 5775
DP: 80
S-IP: B
D-IP:C
P1 P4 P2 P1P3
SP: 5775
DP: 80
S-IP: B
D-IP:C
Sender: Receiver:
treat segment contents compute checksum of
as sequence of 16-bit received segment
integers check if computed checksum
checksum: addition (1’s equals checksum field value:
NO - error detected
complement sum) of
segment contents YES - no error detected.
1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
wraparound 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1
sum 1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 1 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1
Transport Layer 3-19
Chapter 3 outline
3.1 Transport-layer 3.5 Connection-
services oriented transport:
3.2 Multiplexing and TCP
demultiplexing segment structure
3.3 Connectionless
reliable data transfer
flow control
transport: UDP
connection
3.4 Principles of
management
reliable data transfer 3.6 Principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-21
TCP: Overview RFCs: 793, 1122, 1323,
2018, 2581
Host A Host B
User Seq=4
2, AC
K=79, 79
42 data = ‘john
’
host ACKs
receipt, echoes
ss’ back ‘pass’
= ‘pa
, data
K=46
q=79, AC
Se
host ACKs
receipt, send
back use Seq=4
6, ACK
=83 da
password ta =‘CNT
4704’
Sequence number is
time
based on bytes, not packets!
simple telnet scenario
ACK Only in Duplex Communication ?
’
pass
, data = ‘
K=46
q=79, AC
Se
host ACKs
receipt, send
back use Seq=4
6, ACK
=83 da
password ta =‘CNT
4704’
tion
dat a sec
=53,
no time
83 , ACK
Seq=
26
TCP Round Trip Time and
Timeout
Q: how to set TCP Q: how to estimate RTT?
timeout value? SampleRTT: measured time
longer than RTT from segment transmission
but RTT varies
until ACK receipt
ignore retransmissions
too short: premature
timeout SampleRTT will vary, want
unnecessary estimated RTT “smoother”
average several recent
retransmissions
too long: slow measurements, not just
reaction to segment current SampleRTT
loss
350
300
250
RTT (milliseconds)
200
150
100
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconnds)
DevRTT = (1-)*DevRTT +
*|SampleRTT-EstimatedRTT|
(typically, = 0.25)
Seq=9 Seq=9
2, 8 b 2, 8 b
y t es d y t es d
at a
Seq=92 timeout
at a Seq=
100,
20 b y
t es d
timeout
ata
=100
ACK 0
10
X CK
A AC
=
K =120
loss
Seq=9 Seq=9
2, 8 b 2, 8 b
y t es d Sendbase y t es d
at a
at a
Seq=92 timeout
= 100
SendBase
= 120 =1 20
K
CK =100 AC
A
SendBase
= 100 SendBase
= 120 premature timeout
time time
lost ACK scenario
Transport Layer 3-34
TCP retransmission scenarios
(more)
Host A Host B
Seq=9
2, 8 b
y t es d
at a
=100
timeout
Seq=1 A CK
00 , 2 0
b y t es
dat a
X
loss
SendBase CK =120
A
= 120
time
Cumulative ACK scenario
X
timeout
r es e n
d 2 nd s
egme
nt
time
timed wait
ACK
replies with ACK. Closes
connection, sends FIN.
closed
closed
TCP server
lifecycle
TCP client
lifecycle
co n g e stio n
w in d o w
2 4 K b yte s
Saw tooth
behavior: probing 1 6 K b yte s
for bandwidth
8 K b yte s
time
tim e
RTT
first loss event:
two segm
double CongWin every en ts
RTT
done by incrementing
four segm
CongWin for every ents
ACK received
Summary: initial rate
is slow but ramps up
exponentially fast time
CWND
before timeout.
Implementation:
Variable Threshold
At loss event, Threshold
is set to 1/2 of CongWin
just before loss event