Professional Documents
Culture Documents
Chapter 3
Transport Layer
Computer
Networking: A Top
Down Approach
7th edition
All material copyright 1996-2016 Jim Kurose, Keith Ross
J.F Kurose and K.W. Ross, All Rights Reserved Pearson/Addison Wesley
April 2016
Transport Layer 3-1
Chapter 3: Transport Layer
our goals:
understand learn about Internet
principles behind transport layer
transport layer protocols:
services: UDP: connectionless
multiplexing, transport
demultiplexing TCP: connection-
reliable data oriented reliable
transfer transport
flow control TCP congestion control
congestion control
Transport Layer 3-2
Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
reliable data transfer
3.4 principles of reliable data transfer
flow control
connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-3
Transport services and protocols
application
transport
provide logical network
data link
communication between app physical
processes running on
different hosts
lo
gi
ca
transport protocols run in
le
nd
end systems
- en
d
send side: breaks app
tra
ns
po
messages into
rt
segments, passes to application
segments into
messages, passes to
app layer
Transport Layer 3-4
more than one transport
Transport vs. network layer
network layer: household analogy:
logical
communication 12 kids in Ann’s house sending
letters to 12 kids in Bill’s
between hosts house:
transport layer: hosts = houses
delivery (TCP)
data link
physical
network
network data link
congestion control
lo
data link physical
gi
physical
ca
network
flow control
l
data link
en
physical
d-
en
connection setup network
d
tra
data link
physical
ns
unreliable,
po
network
data link
rt
unordered delivery: network
data link
physical
application
UDP physical
network
data link
transport
network
data link
physical
no-frills extension of physical
“best-effort” IP
services not
available: Transport Layer 3-6
Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
reliable data transfer
3.4 principles of reliable data transfer
flow control
connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-7
Multiplexing/demultiplexing
multiplexing at sender:
handle data from multiple demultiplexing at receiver:
sockets, add transport header use header info to deliver
(later used for demultiplexing) received segments to correct
socket
application
application
application P4 P5 P6 application
P3 P2 P3
transport
transport transport
network
network link network
link physical link
physical server: IP physical
address B
length checksum
why is there a UDP?
no connection
application establishment (which can
data add delay)
(payload) simple: no connection
state at sender, receiver
small header size
UDP segment format
no congestion control:
UDP can blast away as
fast as desired
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
send receive
side side
sender receiver
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
U L/R .008
sender = = = 0.00027
RTT + L / R 30.008
U 3L / R .0024
sender = = = 0.00081
RTT + L / R 30.008
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
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 Layer 3-67
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
ACK=100
timeout
ACK=100
ACK=100
ACK=100
Seq=100, 20 bytes of data
IP
flow control code
receiver controls sender, so
sender won’t overflow receiver’s
buffer by transmitting too much, from sender
too fast
receiver protocol stack
application application
network network
2-way handshake:
Q: will 2-way
handshake always
Let’s talk work in network?
ESTAB
OK
variable delays
ESTAB retransmitted messages (e.g.
req_conn(x)) due to
message loss
message reordering
choose x
req_conn(x) can’t “see” other side
ESTAB
acc_conn(x)
ESTAB
choose x choose x
req_conn(x) req_conn(x)
ESTAB ESTAB
retransmit acc_conn(x) retransmit acc_conn(x)
req_conn(x) req_conn(x)
ESTAB ESTAB
data(x+1) accept
req_conn(x)
retransmit data(x+1)
data(x+1)
connection connection
client x completes server x completes server
client
terminates forgets x terminates forgets x
req_conn(x)
ESTAB ESTAB
data(x+1) accept
half open connection! data(x+1)
(no client!)
Transport Layer 3-77
TCP 3-way handshake
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
end-end network-assisted
congestion congestion
control: control:
no explicit feedback routers provide feedback
from network to end systems
congestion inferred single bit
from end-system indicating
observed loss, delay
congestion (SNA,
approach taken by DECbit, TCP/IP
TCP
ECN, ATM)
explicit rate for
Transport Layer 3-83
Explicit Congestion Notification (ECN)
network-assisted congestion control:
two bits in IP header (ToS field) marked by network
router to indicate congestion
congestion indication carried to receiving host
receiver (seeing congestion indication in IP datagram) )
sets ECE bit on receiver-to-sender ACK segment to
notify sender of congestion
TCP ACK segment
source destination
application application
ECE=1
transport transport
network network
link link
physical physical
ECN=00 ECN=11
IP datagram
Transport Layer 3-84
Chapter 3 outline
3.1 transport-layer services
3.5 connection-oriented
transport: TCP
3.2 multiplexing and demultiplexing
3.3 connectionless transport:UDPsegment structure
reliable data transfer
3.4 principles of reliable data transfer
flow control
connection
management
3.6 principles of
congestion control
3.7 TCP congestion
control
Transport Layer 3-85
TCP congestion control: additive increase
multiplicative decrease
approach: sender increases transmission rate (window
size), probing for usable bandwidth, until loss occurs
additive increase: increase cwnd by 1 MSS every
RTT until loss detected
multiplicative decrease: cut cwnd in half after loss
additively increase window size …
…. until loss occurs (then cut window in half)
congestion window size
cwnd: TCP sender
time
Transport Layer 3-86
TCP Congestion Control: details
sender sequence number space
cwnd TCP sending rate:
roughly: send cwnd
bytes, wait RTT for
last byte
ACKed sent, not-
last byte
sent ACKS, then send
yet ACKed
(“in-flight”) more bytes
cwnd
~
sender limits rate ~
RTT
bytes/sec
transmission:
LastByteSent- < cwnd
LastByteAcked
cwnd is dynamic,
function of perceived Transport Layer 3-87
TCP Slow Start
Host A Host B
when connection
begins, increase rate
exponentially until one segm
ent
RTT
first loss event:
two segm
initially cwnd = 1 ents
MSS
double cwnd every four segm
ents
RTT
done by incrementing
cwnd for every ACK
received time
Implementation:
variable ssthresh
on loss event, ssthresh
is set to 1/2 of cwnd just
before loss event
bottleneck
router
capacity R
TCP connection 2
Connection 1 throughput R
Transport Layer 3-92
Fairness (more)
Fairness and UDP Fairness, parallel TCP
multimedia apps connections
often do not use application can open
TCP multiple parallel
do not want rate connections between
throttled by two hosts
congestion control
web browsers do this
instead use UDP:
e.g., link of rate R with
send audio/video at
constant rate, 9 existing connections:
tolerate packet loss new app asks for 1 TCP, gets rate
R/10
new app asks for 9 TCPs, gets R/2
Transport Layer 3-93
Chapter 3: summary
principles behind
transport layer next:
services: leaving the
multiplexing, network “edge”
demultiplexing (application,
reliable data transfer transport layers)
into the network
flow control
congestion control “core”
two network layer
instantiation, chapters:
implementation in the • data plane
Internet • control plane
UDP
Transport Layer 3-94
Transport Layer: Main Lessons
Logical Communications between:
App Layer: End-users
Transport: Processes
Network: Hosts
Transport Layer Protocols