Académique Documents
Professionnel Documents
Culture Documents
Transport
Layer
A note on the use of these ppt slides:
Were making these slides freely available to all (faculty, students, readers).
Theyre in PowerPoint form so you see the animations; and can add, modify,
and delete slides (including this one) and slide content to suit your needs.
They obviously represent a lot of work on our part. In return for use, we only
ask the following:
If you use these slides (e.g., in a class) that you mention their source
(after all, wed like people to use our book!)
If you post any slides on a www site, that you note that they are adapted
from (or perhaps identical to) our slides, and note our copyright of this
material.
Thanks and enjoy! JFK/KWR
All material copyright 1996-2012
J.F Kurose and K.W. Ross, All Rights Reserved
Computer
Networking: A
Top Down
Approach
6th edition
Jim Kurose, Keith
Ross
Addison-Wesley
March 2012
Transport Layer
3-1
understand
principles behind
transport layer
services:
multiplexing,
demultiplexing
reliable data
transfer
flow control
congestion
control
Transport Layer
3-2
Chapter 3 outline
3.1 transport-layer
services
3.2 multiplexing
and
demultiplexing
3.3 connectionless
transport: UDP
3.4 principles of
reliable data
transfer
3.5 connection-oriented
transport: TCP
segment structure
reliable data
transfer
flow control
connection
management
3-3
l
ca
gi
lo
d
en
den
tr
or
sp
an
provide logical
communication
between app
processes running on
different hosts
transport protocols run
in end systems
send side: breaks
app messages into
segments, passes to
network layer
rcv side:
reassembles
applicatio
n
transport
network
data link
physical
applicatio
n
transport
network
data link
physical
Transport Layer
3-4
relies on,
enhances,
network layer
services
house siblings
network-layer protocol =
postal service
Transport Layer
3-5
Internet transport-layer
protocols
services not
available:
network
data link
physical
network
data link
physical
network
data link
physical
Transport Layer
no-frills extension
of best-effort IP
or
sp
an
unreliable,
unordered
delivery: UDP
network
data link
physical
tr
network
data link
physical
d
en
den
congestion control
flow control
connection setup
network
data link
physical
l
ca
gi
lo
reliable, in-order
delivery (TCP)
applicatio
n
transport
network
data link
physical
network
data link
physical
applicatio
n
transport
network
data link
physical
3-6
Chapter 3 outline
3.1 transport-layer
services
3.2 multiplexing
and
demultiplexing
3.3 connectionless
transport: UDP
3.4 principles of
reliable data
transfer
3.5 connection-oriented
transport: TCP
segment structure
reliable data
transfer
flow control
connection
management
3-7
Multiplexing/demultiplexin
g
multiplexing at sender:
handle data from
multiple
sockets, add transport
header (later used for
demultiplexing)
demultiplexing at receiver:
use header info to deliver
received segments to correct
socket
application
application
P3
P1
P2
application
P4
transport
transport
network
transport
network
link
network
link
physical
link
physical
socket
process
physical
Transport Layer
3-8
host receives IP
datagrams
each datagram has
source IP address,
destination IP address
each datagram carries
one transport-layer
segment
each segment has
source, destination
port number
host uses IP
addresses & port
32 bits
source port #
dest port #
application
data
(payload)
Transport Layer
3-9
Connectionless
demultiplexing
3-10
Connectionless demux:
example
DatagramSocket
serverSocket = new
DatagramSocket
(6428);
DatagramSocket
mySocket2 = new
DatagramSocket
(9157);
application
application
DatagramSocket
mySocket1 = new
DatagramSocket
(5775);
application
P1
P3
P4
transport
transport
transport
network
network
link
network
link
physical
link
physical
physical
source port: 6428
dest port: 9157
source port: ?
dest port: ?
source port: ?
dest port: ?
Transport Layer
3-11
Connection-oriented
demux
TCP socket
identified by 4tuple:
source IP address
source port number
dest IP address
dest port number
demux: receiver
uses all four
values to direct
segment to
appropriate socket
Connection-oriented demux:
example
application
application
P4
P3
P5
application
P6
P2
P3
transport
transport
transport
network
network
link
network
link
physical
link
physical
host: IP
address
A
server:
IP
address
B
source IP,port: B,80
dest IP,port: A,9157
source IP,port: A,9157
dest IP, port: B,80
physical
host: IP
address
C
Transport Layer
3-13
Connection-oriented demux:
example
threaded server
application
application
P3
application
P4
P2
P3
transport
transport
transport
network
network
link
network
link
physical
link
physical
host: IP
address
A
server:
IP
address
B
source IP,port: B,80
dest IP,port: A,9157
source IP,port: A,9157
dest IP, port: B,80
physical
host: IP
address
C
3-14
Chapter 3 outline
3.1 transport-layer
services
3.2 multiplexing
and
demultiplexing
3.3 connectionless
transport: UDP
3.4 principles of
reliable data
transfer
3.5 connection-oriented
transport: TCP
segment structure
reliable data
transfer
flow control
connection
management
3-15
no frills, bare
bones Internet
transport protocol
best effort service,
UDP segments may
be:
lost
delivered out-oforder to app
connectionless:
no handshaking
between UDP
sender, receiver
each UDP segment
UDP use:
streaming
multimedia apps
(loss tolerant, rate
sensitive)
DNS
SNMP (Simple
Network
Management
Protocol)
reliable transfer
over UDP:
add reliability at
application layer
application-specific
3-16
Transport Layer
error
recovery!
dest port #
length
checksum
length, in bytes of
UDP segment,
including header
no connection
establishment (which can
add delay)
simple: no connection
state at sender, receiver
small header size
no congestion control:
UDP can blast away as
fast as desired
Transport Layer
3-17
UDP checksum
Goal: detect errors (e.g., flipped bits) in
transmitted segment
sender:
receiver:
treat segment
contents, including
header fields, as
sequence of 16-bit
integers
checksum: addition
(ones complement
sum) of segment
contents
sender puts
checksum value
into UDP checksum
compute checksum of
received segment
check if computed
checksum equals checksum
field value:
NO - error detected
YES - no error
detected. But
maybe errors
Transport Layer
3-18
Internet checksum:
example
example: add two 16-bit integers
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
3-19
Chapter 3 outline
3.1 transport-layer
services
3.2 multiplexing
and
demultiplexing
3.3 connectionless
transport: UDP
3.4 principles of
reliable data
transfer
3.5 connection-oriented
transport: TCP
segment structure
reliable data
transfer
flow control
connection
management
3-20
3-21
3-22
3-23
deliver_data(): called
by rdt to deliver data to
upper
send
side
receive
side
Transport Layer
3-24
Transport Layer
3-25
rdt_send(data)
packet = make_pkt(data)
udt_send(packet)
sender
Wait for
call from
below
rdt_rcv(packet)
extract (packet,data)
deliver_data(data)
receiver
Transport Layer
3-26
3-27
handling duplicates:
3-29
rdt2.1: discussion
sender:
seq # added to
pkt
two seq. #s (0,1)
will suffice. Why?
must check if
received ACK/NAK
corrupted
twice as many
states
state must
receiver:
must check if received
packet is duplicate
state indicates
whether 0 or 1 is
expected pkt seq
#
3-30
Transport Layer
3-31
retransmits if no ACK
received in this time
if pkt (or ACK) just delayed
(not lost):
retransmission will
be duplicate, but
seq. #s already
handles this
receiver must
specify seq # of pkt
3-32
Transport Layer
being
ACKed
rdt3.0: stop-and-wait
operation
sender
receiver
RTT
sender =
L/R
RTT + L / R
Transport Layer
3-33
Pipelined protocols
pipelining: sender allows multiple, inflight, yet-to-be-acknowledged pkts
range of sequence numbers must be
increased
buffering at sender and/or receiver
3-34
Pipelining: increased
utilization
sender
receiver
RTT
sender =
3L / R
RTT + L / R
Transport Layer
3-35
Pipelined protocols:
overview
Go-back-N:
sender can have
up to N unacked
packets in pipeline
receiver only
sends cumulative
ack
doesnt ack packet
if theres a gap
Selective Repeat:
sender can have up to N
unacked packets in
pipeline
rcvr sends individual ack
for each packet
3-36
Go-Back-N: sender
3-37
GBN: receiver
ACK-only: always send ACK for correctly-received pkt
with highest in-order seq #
may generate duplicate ACKs
need only remember expectedseqnum
out-of-order pkt:
discard (dont buffer): no receiver buffering!
re-ACK pkt with highest in-order seq #
Transport Layer
3-38
GBN in action
Go-Back-N Protocol
Transport Layer
3-39
Selective repeat
sender window
N consecutive seq #s
limits seq #s of sent, unACKed pkts
Transport Layer
3-40
Transport Layer
3-41
Selective repeat
sender
data from above:
receiver
pkt n in [rcvbase,
rcvbase+N-1]
timeout(n):
ACK(n) in
[sendbase,sendbase+N]:
mark pkt n as
received
if n smallest
unACKed pkt,
send ACK(n)
out-of-order: buffer
in-order: deliver (also
deliver buffered, inorder pkts), advance
window to next notyet-received pkt
pkt n in
[rcvbaseN,rcvbase-1]
ACK(n)
otherwise:
ignore
Transport Layer
3-42
Transport Layer
3-43