Beruflich Dokumente
Kultur Dokumente
Transport-layer
services
Multiplexing and
demultiplexing
Connectionless
transport: UDP
Principles of reliable
data transfer
Connection-oriented
transport: TCP
segment structure
reliable data transfer
flow control
connection management
Principles of congestion
control
TCP congestion control
3-1
network
data link
physical
network
data link
physical
g
lo
e
al
ic
nd
-e
nd
network
data link
physical
a
tr
network
data link
physical
network
data link
physical
rt
po
ns
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
segments into messages,
passes to app layer
more than one transport
protocol available to apps
Internet: TCP and UDP
provide
application
transport
network
data link
physical
3-2
3-3
delivery (TCP)
no-frills extension of
best-effort IP
network
data link
physical
network
data link
physical
rt
po
ns
delivery: UDP
network
data link
physical
a
tr
unreliable, unordered
nd
-e
nd
network
data link
physical
e
al
ic
congestion control
flow control
connection setup
network
data link
physical
g
lo
application
transport
network
data link
physical
application
transport
network
data link
physical
3-4
Multiplexing/demultiplexing
Multiplexing at send host:
gathering data from multiple
sockets, enveloping data with
header (later used for
demultiplexing)
= process
P3
P1
P1
application
transport
network
P2
P4
application
transport
network
link
link
physical
host 1
physical
host 2
physical
host 3
3-5
32 bits
source port #
dest port #
application
data
(message)
TCP/UDP segment format
3-6
Connectionless demultiplexing
Create sockets with port
numbers:
segment:
two-tuple:
3-7
SP: 6428
DP: 9157
client
IP: A
P1
P1
P3
SP: 9157
DP: 6428
SP: 6428
DP: 5775
server
IP: C
SP: 5775
DP: 6428
Client
IP:B
Connection-oriented demux
TCP socket identified
by 4-tuple:
source IP address
source port number
dest IP address
dest port number
values to direct
segment to appropriate
socket
3-9
Connection-oriented demux
(cont)
P1
P4
P5
P2
P6
P1P3
SP: 5775
DP: 80
S-IP: B
D-IP:C
client
IP: A
SP: 9157
DP: 80
S-IP: A
D-IP:C
server
IP: C
SP: 9157
DP: 80
S-IP: B
D-IP:C
Client
IP:B
3-10
Figure 11-1
PositionofUDPintheTCP/IPprotocolsuite
3-11
Figure 11-2
UDPversusIP
3-12
Figure 11-3
Portnumbers
3-13
Figure 11-4
IPaddressesversusportnumbers
3-14
Figure 11-5
IANAranges
3-15
Figure 11-6
Socketaddresses
3-16
[RFC 768]
3-17
UDP: more
often used for streaming
multimedia apps
loss tolerant
rate sensitive
Length, in
bytes of UDP
segment,
including
header
32 bits
source port #
dest port #
length
checksum
Application
data
(message)
UDP segment format
3-18
UDP checksum
Goal: detect errors (e.g., flipped bits) in transmitted
segment
Sender:
treat segment contents
as sequence of 16-bit
integers
checksum: addition (1s
complement sum) of
segment contents
sender puts checksum
value into UDP checksum
field
Receiver:
compute checksum of received
segment
check if computed checksum
equals checksum field value:
NO - error detected
YES - no error detected.
But maybe errors
nonetheless? More later .
3-19
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-20
characteristics of unreliable channel will determine complexity of reliable data transfer protocol
(rdt)
3-21
send
side
deliver_data(): called by
rdt to deliver data to upper
receive
side
sender, receiver
state
1
state
2
3-23
Rdt1.0:
Wait for
call from
above
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
3-24
3-25
sender
receiver
rdt_rcv(rcvpkt) &&
corrupt(rcvpkt)
udt_send(NAK)
Wait for
call from
below
rdt_rcv(rcvpkt) &&
notcorrupt(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)
3-26
happened at receiver!
cant just retransmit:
possible duplicate
Handling duplicates:
sequence
number to each pkt
sender retransmits current
pkt if ACK/NAK garbled
receiver discards (doesnt
deliver up) duplicate pkt
sender adds
3-27
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
Receiver:
must check if received
packet is duplicate
not
3-28
received OK
3-29
rdt3.0 in action
3-31
rdt3.0 in action
3-32
Performance of rdt3.0
rdt3.0 works, but performance stinks
example: 1 Gbps link, 15 ms e-e prop. delay, 1KB packet:
Ttransmit =
=
sender
L/R
RTT + L / R
.008
30.008
= 0.00027
microsec
onds
receiver
RTT
=
sender
L/R
RTT + L / R
.008
30.008
= 0.00027
microsec
onds
3-34
Pipelined protocols
Pipelining: sender allows multiple, in-flight, yet-tobe-acknowledged pkts
selective repeat
go-Back-N,
3-35
receiver
RTT
Increase utilization
by a factor of 3!
sender
3*L/R
RTT + L / R
.024
30.008
= 0.0008
microsecon
ds
3-36
ERRORCONTROL
(Example)
3-37
Figure 12-13
Corruptedsegment
3-38
Figure 12-14
Lostsegment
3-39
Figure 12-15
Lostacknowledgment
3-40
Go-Back-N
Sender:
k-bit seq # in pkt header
window of up to N, consecutive unacked pkts allowed
Transport Layer
3-41
out-of-order pkt:
discard (dont buffer) -> no receiver buffering!
Re-ACK pkt with highest in-order seq #
Transport Layer
3-42
GBN in
action
Transport Layer
3-43
Selective Repeat
individually acknowledges all correctly
received pkts
receiver
received
sender window
N consecutive seq #s
again limits seq #s of sent, unACKed pkts
Transport Layer
3-44
Transport Layer
3-45
Selective repeat
sender
data from above :
receiver
pkt n in [rcvbase, rcvbase+N-1]
send ACK(n)
timeout(n):
ACK(n) in [sendbase,sendbase+N]:
mark pkt n as received
if n smallest unACKed pkt,
out-of-order: buffer
pkt n in
[rcvbase-N,rcvbase-1]
ACK(n)
otherwise:
ignore
Transport Layer
3-46
Transport Layer
3-47
Selective repeat:
dilemma
Example:
seq #s: 0, 1, 2, 3
window size=3
receiver sees no
difference in two
scenarios!
incorrectly passes
duplicate data as new in
(a)
Q: what relationship
between seq # size and
window size?
Transport Layer
3-48
TCP: Overview
point-to-point:
one sender, one receiver
reliable, in-order
stream:
byte
no message boundaries
pipelined:
TCP congestion and flow
control set window size
socket
door
a p p lic a t io n
re a d s d a ta
TC P
s e n d b u ffe r
TC P
r e c e iv e b u f f e r
segm ent
3-49
Figure 12-19
TCPsegmentformat
3-50
Figure 12-20
Controlfield
3-51
source port #
dest port #
sequence number
acknowledgement number
head not
UA P R S F
len used
checksum
Receive window
Urg data pnter
counting
by bytes
of data
(not segments!)
# bytes
rcvr willing
to accept
application
data
(variable length)
3-52
Host B
Host A
User
types
C
Seq=4
2, AC
K
=79, d
ata =
C
= C
a
t
a
d
=43,
K
C
A
79,
Seq=
host ACKs
receipt
of echoed
C
Seq=4
3, ACK
host ACKs
receipt of
C, echoes
back C
=80
time
3-53
timeout
unnecessary
retransmissions
too long: slow reaction
to segment loss
3-54
3-55
DevRTT = (1-)*DevRTT +
*|SampleRTT-EstimatedRTT|
(typically, = 0.25)
Then set timeout interval:
TimeoutInterval = EstimatedRTT + 4*DevRTT
3-56
Retransmissions are
triggered by:
timeout events
duplicate acks
Initially consider
3-57
timeout:
retransmit segment
that caused timeout
restart timer
Ack rcvd:
If acknowledges
previously unacked
segments
3-58
connection has a
receive buffer:
flow control
speed-matching
guarantees receive
buffer doesnt overflow
= RcvWindow
= RcvBuffer-[LastByteRcvd LastByteRead]
3-60
Aslidingwindowisusedtomake
transmissionmore
efficientaswellastocontroltheflowof
datasothatthedestination
doesnotbecomeoverwhelmedwithdata.
TCPsslidingwindowsarebyteoriented.
3-61
62
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.6 Principles of
congestion control
3.7 TCP congestion
control
3-63
6-31
3-65
Figure 12-28
Threewayhandshaking
3-66
client
close
close
FIN
timed wait
FIN
ACK
server
A CK
closed
3-67
client
closing
closing
FIN
timed wait
Connection closed.
FIN
ACK
server
A CK
closed
closed
3-68
Figure 12-29
Fourwayhandshaking
3-69
Thank You
3-70