IRI - Chap3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 148

Introduction to Computer

Networking

Guy Leduc

Chapter 3 Computer Networking: A


Top Down Approach,
Transport Layer 8th edition.
Jim Kurose, Keith Ross
Pearson, 2020

3-1
Transport layer: overview
Our goal:
§ understand principles § learn about Internet transport
behind transport layer layer protocols:
services: • UDP: connectionless transport
• multiplexing, • TCP: connection-oriented reliable
demultiplexing transport
• reliable data transfer • TCP congestion control
• flow control
• congestion control

© From Computer Networking, by Kurose&Ross Transport Layer: 3-2


Chapter 3: roadmap
§ Transport-layer services
§ Multiplexing and demultiplexing
§ Connectionless transport: UDP
§ Principles of reliable data transfer
§ Connection-oriented transport: TCP
§ TCP congestion control
§ Evolution of transport-layer
functionality

© From Computer Networking, by Kurose&Ross Transport Layer: 3-3


Transport services and protocols
application
transport

§ provide logical communication mobile network


network
data link
physical

between application processes national or global ISP

running on different hosts

lo g
ica
l en
d -e
§ two transport protocols available to

nd
Internet applications local or

tra
regional ISP

n sp
• TCP, UDP

o rt
home network content
provider
network datacenter
application
network
transport
network
data link
physical

enterprise
network

© From Computer Networking, by Kurose&Ross Transport Layer: 3-4


Transport Layer Actions

Sender:
application § is passed an application- application
app. msg
layer message
transport § determines segment TThhtransport
app. msg
header fields values
network (IP) § creates segment network (IP)

link § passes segment to IP link

physical physical

© From Computer Networking, by Kurose&Ross Transport Layer: 3-5


Transport Layer Actions

Receiver:
application § receives segment from IP application
§ checks header values
app. msg
transport § extracts application-layer transport
message
network (IP) network (IP)
§ demultiplexes message up
link to application via socket link

physical physical
Th app. msg

© From Computer Networking, by Kurose&Ross Transport Layer: 3-6


Transport vs. network layer
§ network layer (IP): logical Analogy:
communication between hosts § host = institute
§ transport layer (TCP or UDP): logical § process = office
communication between processes § app messages = letters in
• relies on, enhances, network layer envelopes
services
§ transport protocol = janitor
who demux incoming
letters to offices
§ network-layer protocol =
postal service

Transport Layer 3-7


© From Computer Networking, by Kurose&Ross
Two principal Internet transport
protocols application
transport

§ TCP: Transmission Control Protocol mobile network


network
data link
physical

• reliable, in-order delivery national or global ISP

lo g
• congestion control

ica
• flow control

l en
d -e
• connection setup

nd
local or
§ UDP: User Datagram Protocol

tra
regional ISP

n sp
• unreliable, unordered delivery

o rt
home network content
provider
• no-frills extension of “best-effort” IP network datacenter
application
network

§ services not available:


transport
network
data link

• delay guarantees physical

• data rate guarantees enterprise


network

© From Computer Networking, by Kurose&Ross Transport Layer: 3-8


Chapter 3: roadmap
§ Transport-layer services
§ Multiplexing and demultiplexing
§ Connectionless transport: UDP
§ Principles of reliable data transfer
§ Connection-oriented transport: TCP
§ TCP congestion control
§ Evolution of transport-layer
functionality

© From Computer Networking, by Kurose&Ross Transport Layer: 3-9


HTTP server
client
application application
HTTP msg
transport

transport network transport


network link network
link physical link
physical physical

© From Computer Networking, by Kurose&Ross Transport Layer: 3-10


HTTP server
client
application application
HTTP msg
transport
Ht HTTP msg

transport network transport


network link network
link physical link
physical physical

© From Computer Networking, by Kurose&Ross Transport Layer: 3-11


HTTP server
client
application application
HTTP msg
transport
Ht HTTP msg

Hnnetwork
Ht HTTP msg transport
transport
network link network
link physical link
physical physical

© From Computer Networking, by Kurose&Ross Transport Layer: 3-12


HTTP server
client
application application

transport

transport network transport


network link network
link physical link
physical physical

Hn Ht HTTP msg

© From Computer Networking, by Kurose&Ross Transport Layer: 3-13


HTTP server
client1 client2
application P-client1 P-client2 application

transport

transport network transport


network link network
link physical link
physical physical

© From Computer Networking, by Kurose&Ross Transport Layer: 3-14


Multiplexing/demultiplexing
multiplexing at sender: demultiplexing at receiver:
handle data from multiple use header info to deliver
sockets, add transport header received segments to correct
(later used for demultiplexing) socket

application

application P1 P2 application socket


P3 transport P4
process
transport network transport
network link network
link physical link
physical physical

© From Computer Networking, by Kurose&Ross Transport Layer: 3-15


How demultiplexing works
§ host receives IP packets from layer
below 32 bits

• each IP packet has source and source port # dest port #


destination IP addresses
• each IP packet carries one transport- other header fields
layer segment
• each TCP/UDP segment has source and application
destination port numbers data
(payload)
§ host uses IP addresses (in network-
layer header) & port numbers (in
transport-layer header) to direct TCP/UDP segment format
(which is the payload of an IP packet)
segment to appropriate socket
© From Computer Networking, by Kurose&Ross Transport Layer: 3-16
Connectionless (UDP) demultiplexing
Recall: when receiving host receives
§ when creating UDP socket, UDP segment from layer
app may specify host-local below:
port #: • checks destination port # in
segment
DatagramSocket mySocket1
= new DatagramSocket(12534); • directs UDP segment to
socket with that port #
§ when creating datagram to
send into UDP socket,
app must specify remote IP packets containing UDP
payloads with same dest. port #
process id, namely: (but different source IP addresses
• destination IP address and/or source port numbers) will
• destination port # be directed to same socket at
© From Computer Networking, by Kurose&Ross receiving host Transport Layer: 3-17
Connectionless (UDP) demultiplexing: an example
DatagramSocket serverSocket =
new DatagramSocket (6428);
DatagramSocket mySocket2 = DatagramSocket mySocket1 =
new DatagramSocket (9157); new DatagramSocket (5775);
application
application application
P1
P3 P4
Transport UDP
Transport UDP network Transport UDP
network link network
link physical link
physical physical

source port: 6428 source port: 6428


dest port: 9157 dest port: 5775

source port: 9157 source port: 5775


dest port: 6428 dest port: 6428
Destination port: given by app through socket
© From Computer Networking, by Kurose&Ross Source port: set by transport (UDP) Transport Layer: 3-18
Connection-oriented (TCP)
demultiplexing
§ Recall: web servers have § Each TCP socket is associated with a
different TCP sockets for each single TCP connection
connecting client § Thus TCP socket must be identified
• non-persistent HTTP will even have by a connection id, namely a
different sockets for each request 4-tuple:
• source IP address
§ These many simultaneous TCP
• source port number
sockets are all associated with • destination IP address
the same server port #: • destination port number
• so, destination port # is not enough
to direct segment to appropriate
§ Demultiplexing: when TCP receives
socket! a segment from layer below, it uses
all four values to direct segment to
appropriate socket
Transport Layer 3-19
© From Computer Networking, by Kurose&Ross
Connection-oriented (TCP) demultiplexing:
example server:
IP address B
application
application P4,P5,P6: application
port# 80 P4 P5 P6
host: P1 P2 P3 host:
IP address A transport
IP address C
transport transport
P1: network P2:
port# 9157 network link network port# 5775
link physical link
P3:
physical physical port# 9157

source IP,port: B,80


dest IP,port: A,9157 source IP,port: C,5775
dest IP,port: B,80
source IP,port: A,9157
dest IP,port: B,80
source IP,port: C,9157
dest IP,port: B,80

Three TCP segments, all destined to IP address B and dest port 80 are demultiplexed to
different sockets by using source IP and source port #
© From Computer Networking, by Kurose&Ross Transport Layer: 3-20
Summary
§ Multiplexing, demultiplexing: based on segment and packet
header field values
§ UDP: demultiplexing using destination IP address and
destination port number (only)
§ TCP: demultiplexing using 4-tuple: source and destination IP
addresses, and source and destination port numbers
§ Some form of multiplexing/demultiplexing happen at all layers:
§ For example, in the network layer, demultiplexing is used to deliver
the IP packet payload either to TCP or UDP

© From Computer Networking, by Kurose&Ross Transport Layer: 3-21


Chapter 3: roadmap
§ Transport-layer services
§ Multiplexing and demultiplexing
§ Connectionless transport: UDP
§ Principles of reliable data transfer
§ Connection-oriented transport: TCP
§ TCP congestion control
§ Evolution of transport-layer
functionality

© From Computer Networking, by Kurose&Ross Transport Layer: 3-22


UDP: User Datagram Protocol
Why is there a UDP?
§ “no frills,” “bare bones”
Internet transport protocol § no connection
establishment (which can
§ “best effort” service, UDP add RTT delay)
segments may be: § simple: no connection state
• lost at sender, receiver
• delivered out-of-order to app § small header size
§ connectionless: § no congestion control
• no handshaking between UDP § UDP can blast away as fast as
desired!
sender, receiver
§ can function in the face of
• each UDP segment handled congestion
independently of others
© From Computer Networking, by Kurose&Ross Transport Layer: 3-23
UDP: User Datagram Protocol
§ UDP use:
§ Internet telephony
§ some streaming multimedia apps (loss tolerant, rate sensitive)
§ DNS
§ SNMP – Simple Network Management Protocol
§ HTTP/3
§ if reliable transfer needed over UDP (e.g., HTTP/3):
§ add needed reliability at application layer
§ add flow and congestion control at application layer

© From Computer Networking, by Kurose&Ross Transport Layer: 3-24


UDP: User Datagram Protocol [RFC 768]

© From Computer Networking, by Kurose&Ross Transport Layer: 3-25


UDP: Transport Layer Actions

DNS client DNS server

application application

transport transport
(UDP) (UDP)

network (IP) network (IP)

link link

physical physical

© From Computer Networking, by Kurose&Ross Transport Layer: 3-26


UDP: Transport Layer Actions

DNS client DNS server


UDP sender actions:
application § is passed an application- application
DNS msg
layer message and remote
transport process id UDP transport
UDPhh DNS msg
(UDP) (UDP)
§ determines UDP segment
network (IP)
header fields values network (IP)
§ creates UDP segment link
link
§ passes segment to IP physical
physical

© From Computer Networking, by Kurose&Ross Transport Layer: 3-27


UDP: Transport Layer Actions

DNS client DNS server


UDP receiver actions:
application § receives segment from IP application
§ checks UDP checksum
transport transport
DNS msg header value
(UDP) (UDP)
§ extracts application-layer
network
UDP (IP)
h DNS msg
message and source network (IP)
process id
link link
§ demultiplexes message up
physical to application via socket physical

© From Computer Networking, by Kurose&Ross Transport Layer: 3-28


UDP segment header
32 bits
source port # dest port #
length checksum

application length, in bytes of


data UDP segment,
(payload) including header

data to/from
UDP segment format application layer

© From Computer Networking, by Kurose&Ross Transport Layer: 3-29


UDP checksum
Goal: detect errors (i.e., flipped bits) in transmitted segment
1st number 2nd number sum

Transmitted: 5 6 11

Received: 4 6 11

receiver-computed
checksum
= sender-computed
checksum (as received)

© From Computer Networking, by Kurose&Ross Transport Layer: 3-30


Internet checksum
Goal: detect errors (i.e., flipped bits) in transmitted segment
sender: receiver:
§ treat contents of UDP § compute checksum of received
segment (including UDP header segment
fields) as sequence of 16-bit
integers § check if computed checksum equals
§ checksum: addition (one’s checksum field value:
complement sum) of segment • not equal - error detected
content • equal - no error detected. But maybe
errors nonetheless? More later …
§ checksum value put into
UDP checksum field

© From Computer Networking, by Kurose&Ross Transport Layer: 3-31


Internet checksum: an example
example: add two 16-bit integers
1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0
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 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0
checksum 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1

Note: when adding numbers, a carryout from the most significant bit needs to be
added to the result (this is one’s complement addition)

© From Computer Networking, by Kurose&Ross Transport Layer: 3-32


Internet checksum: weak protection!
example: add two 16-bit integers 0
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 Even though
numbers have
sum 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 changed (bit
flips), no change
checksum 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1 in checksum!

© From Computer Networking, by Kurose&Ross Transport Layer: 3-33


Summary: UDP
§ “no frills” protocol:
• segments may be lost, delivered out of order
• best effort service: “send and hope for the best”
§ UDP has its plusses:
• no setup/handshaking needed (no RTT incurred)
• helps with reliability (optional checksum)
§ build additional functionality on top of UDP in application layer
(e.g., HTTP/3)

© From Computer Networking, by Kurose&Ross Transport Layer: 3-34


Chapter 3: roadmap
§ Transport-layer services
§ Multiplexing and demultiplexing
§ Connectionless transport: UDP
§ Principles of reliable data transfer
• Alternating-bit protocol
• Pipelined protocols
§ Connection-oriented transport: TCP
§ TCP congestion control
§ Evolution of transport-layer
functionality
© From Computer Networking, by Kurose&Ross Transport Layer: 3-35
Principles of reliable data transfer

sending receiving
process process
application data data
transport
reliable channel

reliable service abstraction

© From Computer Networking, by Kurose&Ross Transport Layer: 3-36


Principles of reliable data transfer

sending receiving sending receiving


process process process process
application data data application data data
transport transport
reliable channel
sender-side of receiver-side
reliable service abstraction reliable data of reliable data
transfer protocol transfer protocol

transport
network
unreliable channel

reliable service implementation

© From Computer Networking, by Kurose&Ross Transport Layer: 3-37


Principles of reliable data transfer

sending receiving
process process
application data data
transport

sender-side of receiver-side
Complexity of reliable data reliable data
transfer protocol
of reliable data
transfer protocol
transfer protocol will depend
(strongly) on characteristics of transport
network
unreliable channel (lose, unreliable channel
corrupt, reorder data?)
reliable service implementation

© From Computer Networking, by Kurose&Ross Transport Layer: 3-38


Principles of reliable data transfer

sending receiving
process process
application data data
transport

sender-side of receiver-side
Sender, receiver do not know reliable data
transfer protocol
of reliable data
transfer protocol
the “state” of each other, e.g.,
was a message received? transport
network
§ unless communicated via a unreliable channel

message
reliable service implementation

© From Computer Networking, by Kurose&Ross Transport Layer: 3-39


Reliable data transfer protocol (rdt): interfaces
rdt_send(): called from above, deliver_data(): called by rdt
(e.g., by app.). Passed data to to deliver data to upper layer
deliver to receiver upper layer
sending receiving
process process
rdt_send() data data
deliver_data()

sender-side data receiver-side


implementation of implementation of
rdt reliable data packet rdt reliable data
transfer protocol transfer protocol

udt_send() Header data Header data rdt_rcv()

unreliable channel
udt_send(): called by rdt rdt_rcv(): called when packet
to transfer packet over Bi-directional communication over arrives on receiver side of
unreliable channel to receiver unreliable channel channel
© From Computer Networking, by Kurose&Ross Transport Layer: 3-40
Reliable data transfer: getting started
We will:
§ incrementally develop sender, receiver sides of reliable data transfer
protocol (rdt)
§ consider only unidirectional data transfer
• but control info will flow in both directions!
§ use finite state machines (FSM) to specify sender, receiver
event causing state transition
actions taken on state transition
state: when in this “state”
next state uniquely state state
determined by next 1 event
event 2
actions

© From Computer Networking, by Kurose&Ross Transport Layer: 3-41


rdt1.0: reliable transfer over a reliable
channel
§ underlying channel perfectly reliable
• no bit errors
• no loss of packets

§ separate FSMs for sender, receiver:


• sender sends data into underlying channel
• receiver reads data from underlying channel

Wait for rdt_send(data) Wait for rdt_rcv(packet)


sender call from packet = make_pkt(data) receiver call from extract (packet,data)
above udt_send(packet) below deliver_data(data)

© From Computer Networking, by Kurose&Ross Transport Layer: 3-42


rdt2.0: channel with bit errors
§ underlying channel may flip bits in packet
• checksum (e.g., Internet checksum) to detect bit errors
§ the question: how to recover from errors?

How do humans recover from “errors” during conversation?

© From Computer Networking, by Kurose&Ross Transport Layer: 3-43


rdt2.0: channel with bit errors
§ underlying channel may flip bits in packet
• checksum to detect bit errors
§ the question: how to recover from errors?
• acknowledgements (ACKs): receiver pkt A
explicitly tells sender that pkt received OK OK
ACK
• negative acknowledgements (NAKs): pkt B
Error
receiver explicitly tells sender that pkt had NAK
detected
errors pkt B
ACK OK
• sender retransmits pkt on receipt of NAK

stop and wait


sender sends one packet, then waits for receiver response
© From Computer Networking, by Kurose&Ross Transport Layer: 3-44
rdt2.0: FSM specifications
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
Wait for Wait for isNAK(rcvpkt)
sender call from ACK or udt_send(sndpkt) rdt_rcv(rcvpkt) && corrupt(rcvpkt)
above NAK
udt_send(NAK)

rdt_rcv(rcvpkt) && isACK(rcvpkt)


Wait for
L call from receiver
below

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)


extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)

© From Computer Networking, by Kurose&Ross Transport Layer: 3-45


rdt2.0: FSM specification
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
Wait for Wait for isNAK(rcvpkt)
sender call from ACK or udt_send(sndpkt) rdt_rcv(rcvpkt) && corrupt(rcvpkt)
above NAK
udt_send(NAK)

rdt_rcv(rcvpkt) && isACK(rcvpkt)


Wait for
L call from receiver
below

Note: “state” of receiver (did the receiver get my


message correctly?) isn’t known to sender unless rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
extract(rcvpkt,data)
somehow communicated from receiver to sender deliver_data(data)
§ that’s why we need a protocol! udt_send(ACK)

© From Computer Networking, by Kurose&Ross Transport Layer: 3-46


rdt2.0: operation with no errors
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
Wait for Wait for isNAK(rcvpkt)
sender call from ACK or udt_send(sndpkt) rdt_rcv(rcvpkt) && corrupt(rcvpkt)
above NAK
udt_send(NAK)

rdt_rcv(rcvpkt) && isACK(rcvpkt)


Wait for
L call from receiver
below

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)


extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)

© From Computer Networking, by Kurose&Ross Transport Layer: 3-47


rdt2.0: corrupted packet scenario
rdt_send(data)
snkpkt = make_pkt(data, checksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) &&
Wait for Wait for isNAK(rcvpkt)
sender call from ACK or udt_send(sndpkt) rdt_rcv(rcvpkt) && corrupt(rcvpkt)
above NAK
udt_send(NAK)

rdt_rcv(rcvpkt) && isACK(rcvpkt)


Wait for
L call from receiver
below

rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)


extract(rcvpkt,data)
deliver_data(data)
udt_send(ACK)

© From Computer Networking, by Kurose&Ross Transport Layer: 3-48


rdt2.0 has a fatal flaw!
what happens if ACK/NAK corrupted? handling duplicates:
§ corrupted/garbled ACK/NAK detected
by checksum too! § sender retransmits current pkt
if ACK/NAK garbled
§ garbled ACK/NAK discarded
§ sender doesn’t know what happened at § sender adds sequence number
receiver! to each pkt
§ can’t just retransmit: possible duplicate § receiver discards (doesn’t
deliver up) duplicate pkt
pkt

garbled ACK OK stop and wait


sender sends one packet, then
same pkt
Duplicate! waits for receiver response

© From Computer Networking, by Kurose&Ross Transport Layer: 3-49


rdt2.1: sender, handling garbled ACK/NAKs
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt) rdt_rcv(rcvpkt) &&
(corrupt(rcvpkt) ||
Wait for Wait for isNAK(rcvpkt) )
call 0 from ACK or
NAK 0 udt_send(sndpkt)
above
rdt_rcv(rcvpkt)
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) &&
&& notcorrupt(rcvpkt)
isACK(rcvpkt)
&& isACK(rcvpkt)
L
L
Wait for Wait for
ACK or call 1 from
rdt_rcv(rcvpkt) NAK 1 above
&& (corrupt(rcvpkt) ||
isNAK(rcvpkt) ) rdt_send(data)
udt_send(sndpkt) sndpkt = make_pkt(1, data, checksum)
udt_send(sndpkt)

© From Computer Networking, by Kurose&Ross Transport Layer: 3-50


rdt2.1: receiver, handling garbled
ACK/NAKs rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq0(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)
rdt_rcv(rcvpkt) && corrupt(rcvpkt) rdt_rcv(rcvpkt) && corrupt(rcvpkt)
sndpkt = make_pkt(NAK, chksum) sndpkt = make_pkt(NAK, chksum)
udt_send(sndpkt) udt_send(sndpkt)
Wait for Wait for
rdt_rcv(rcvpkt) && 0 from 1 from rdt_rcv(rcvpkt) &&
not corrupt(rcvpkt) && below below not corrupt(rcvpkt) &&
has_seq1(rcvpkt) has_seq0(rcvpkt)
sndpkt = make_pkt(ACK, chksum) sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt) udt_send(sndpkt)
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq1(rcvpkt) Note: receiver sends
extract(rcvpkt,data) ACK in this case.
deliver_data(data) Why?
sndpkt = make_pkt(ACK, chksum)
udt_send(sndpkt)

© From Computer Networking, by Kurose&Ross Transport Layer: 3-51


rdt2.1: discussion
sender: receiver:
§ seq # added to pkt § must check if received packet
§ two seq. #s (0,1) will suffice. is duplicate
Why? • state indicates whether 0 or 1 is
expected pkt seq #
§ must check if received ACK/NAK
§ note: receiver can not know if
corrupted
its last ACK/NAK received OK
§ twice as many states at sender
• state must “remember” whether
“expected” pkt should have seq #
of 0 or 1

© From Computer Networking, by Kurose&Ross Transport Layer: 3-52


rdt3.0: channels with errors and loss
New channel assumption: underlying channel can also lose
packets (data, ACKs)
• checksum, sequence #s, ACKs, retransmissions will be of help …
but not quite enough

Q: How do humans handle lost sender-to-


receiver words in conversation?

© From Computer Networking, by Kurose&Ross Transport Layer: 3-53


rdt3.0: channels with errors and loss
Approach: sender waits “reasonable” amount of time for ACK
§ use countdown timer to interrupt after “reasonable” amount
of time
§ 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!
pkt(0)
pkt(0)
X ACK
X
pkt(0) pkt(0)
Timeout Timeout Discard but ACK!
ACK ACK
No duplicate

Transport Layer: 3-54


rdt3.1: actually no need for NAKs!
§Up to now: § Simpler:
• Timer for packet loss • Timer for both packet loss and
errors!
• NAK for packet errors § NAK would improve recovery time, but
it’s not our concern here!

rdt3.0: With ACKs & NAKs rdt3.1: With ACKs only


pkt(0) pkt(0)
ACK OK ACK OK
pkt(1) pkt(1)
NAK Error Error
pkt(1) Timeout pkt(1)
ACK OK ACK OK

Transport Layer 3-55


Flaw in rdt3.1: Delayed packets or ACKs
If pkt (or ACK) just delayed (not lost): However, race conditions are
§ retransmission will be duplicate, but use of possible between the received
seq. #’s already handles this ACK and the retransmitted
packet!
pkt(0)
A
A received
pkt(0) ACK
Timeout
ACK Discard (no dupl)
B Resend ACK
B ACKed pkt(1) X
but lost! B not recovered
C pkt(0)
Discard again,
ACK Still expects #1!
C ACKed C not recovered
but lost!

Note: such race conditions are only possible over full-duplex channels
3-56
rdt3.2: adding seq # in ACKs
receiver must specify seq # of pkt being ACKed

pkt(0)
A
A received
pkt(0) ACK(0)
Timeout
ACK(0) Discard (no dupl)
B Resend ACK
B not pkt(1) X
ACKed
pkt(1)
Timeout
ACK(1) B recovered

3-57
rdt3.2 sender
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt)
start_timer

Wait for Wait


call 0 from for
above ACK0
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) rdt_rcv(rcvpkt)
&& isACK(rcvpkt,1) && notcorrupt(rcvpkt)
stop_timer && isACK(rcvpkt,0)
stop_timer
Wait Wait for
for call 1 from
ACK1 above

rdt_send(data)
sndpkt = make_pkt(1, data, checksum)
udt_send(sndpkt)
start_timer

© From Computer Networking, by Kurose&Ross Transport Layer: 3-58


rdt3.2 sender
rdt_send(data)
rdt_rcv(rcvpkt) &&
sndpkt = make_pkt(0, data, checksum) ( corrupt(rcvpkt) ||
udt_send(sndpkt) isACK(rcvpkt,1) )
rdt_rcv(rcvpkt) start_timer L
L Wait for Wait
timeout
call 0 from for
ACK0 udt_send(sndpkt)
above
start_timer
rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt) rdt_rcv(rcvpkt)
&& isACK(rcvpkt,1) && notcorrupt(rcvpkt)
stop_timer && isACK(rcvpkt,0)
stop_timer
Wait Wait for
timeout for call 1 from
udt_send(sndpkt) ACK1 above
start_timer rdt_rcv(rcvpkt)
rdt_send(data) L
rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) || sndpkt = make_pkt(1, data, checksum)
isACK(rcvpkt,0) ) udt_send(sndpkt)
start_timer
L

© From Computer Networking, by Kurose&Ross Transport Layer: 3-59


rdt3.2 = Alternating-Bit Protocol (1969) in action
sender receiver sender receiver
send pkt0 pkt0 send pkt0 pkt0
rcv pkt0 rcv pkt0
ack0 send ack0 ack0 send ack0
rcv ack0 rcv ack0
send pkt1 pkt1 send pkt1 pkt1
rcv pkt1 X
loss
ack1 send ack1
rcv ack1
send pkt0 pkt0
rcv pkt0 timeout
ack0 send ack0 resend pkt1 pkt1
rcv pkt1
ack1 send ack1
rcv ack1
send pkt0 pkt0
(a) no loss rcv pkt0
ack0 send ack0

(b) packet loss


© From Computer Networking, by Kurose&Ross Transport Layer: 3-60
rdt3.2 in action
sender receiver
sender receiver send pkt0
pkt0
rcv pkt0
send pkt0 pkt0 send ack0
ack0
rcv pkt0 rcv ack0
ack0 send ack0 send pkt1 pkt1
rcv ack0 rcv pkt1
send pkt1 pkt1 send ack1
rcv pkt1 ack1
ack1 send ack1
X timeout
loss resend pkt1
pkt1 rcv pkt1
timeout
resend pkt1 pkt1
rcv pkt1 rcv ack1 (detect duplicate)
send pkt0 pkt0 send ack1
(detect duplicate)
ack1 send ack1 ack1 rcv pkt0
rcv ack1 rcv ack1 send ack0
send pkt0 pkt0 (ignore) ack0
rcv pkt0
ack0 send ack0 pkt1

(c) ACK loss (d) premature timeout/ delayed ACK


© From Computer Networking, by Kurose&Ross Transport Layer: 3-61
rdt3.3: ACK policy improvement
§ instead of dropping silently packets with wrong numbers,
receiver may send ACK for last pkt received OK
§ receiving duplicate ACK at sender results in same action as
receiving NAK: retransmit current pkt
§ improves performance: packet retransmitted earlier

As we will see, TCP uses a similar approach (and is NAK-free)

Transport Layer: 3-62


rdt3.3: sender, receiver fragments
rdt_send(data)
sndpkt = make_pkt(0, data, checksum)
udt_send(sndpkt) rdt_rcv(rcvpkt) &&
( corrupt(rcvpkt) ||
Wait for Wait for
ACK isACK(rcvpkt,1) )
call 0 from
above 0 udt_send(sndpkt)
sender FSM
fragment rdt_rcv(rcvpkt)
&& notcorrupt(rcvpkt)
rdt_rcv(rcvpkt) && && isACK(rcvpkt,0)
(corrupt(rcvpkt) || L
has_seq1(rcvpkt)) Wait for receiver FSM
0 from
udt_send(sndpkt) below fragment
rdt_rcv(rcvpkt) && notcorrupt(rcvpkt)
&& has_seq1(rcvpkt)
extract(rcvpkt,data)
deliver_data(data)
sndpkt = make_pkt(ACK1, chksum)
udt_send(sndpkt) Transport Layer: 3-63
© From Computer Networking, by Kurose&Ross
rdt3.2/3.3 still incorrect if pkt or ACK reordering possible

pkt(0)

Timeout
resend pkt(0) pkt(0) ACK(0) pkt reordering
This delay can be
arbitrarily small
pkt(1)

ACK(1)
ACK(0) Duplicate!
pkt(0) X But considered
pkt(0) as new pkt(0)!
ACKed
but lost!
Solution: Choose timeout so large that when a pkt is retransmitted the sender is sure that
the previous copy of this pkt and its ACK have disappeared from the network.
Better solution: Use a much larger seq# space (see later).
Transport Layer 3-64
Performance of rdt3.2/3.3 (stop-and-wait)
§ Usender: utilization – fraction of time sender busy sending

§ example: 1 Gbps link, 15 ms prop. delay, 8000 bit packet


• time to transmit packet into channel:
L 8000 bits
Dtrans = R = 9 = 8 microsecs
10 bits/sec

© From Computer Networking, by Kurose&Ross Transport Layer: 3-65


rdt3.2/3.3: stop-and-wait operation
sender receiver
first packet bit transmitted, t = 0

first packet bit arrives


RTT last packet bit arrives, send ACK

ACK arrives, send next


packet, t = RTT + L / R

© From Computer Networking, by Kurose&Ross Transport Layer: 3-66


rdt3.2/3.3: stop-and-wait operation
sender receiver

L/R L/R
Usender=
RTT + L / R
.008 RTT
=
30.008
= 0.00027

R . RTT/2 = “Bandwidth”-delay product


= “in-flight” bits

§ rdt 3.2/3.3 protocol performance poor when “bandwidth”-delay product is large


§ Protocol limits performance of underlying infrastructure (channel)
© From Computer Networking, by Kurose&Ross Transport Layer: 3-67
Chapter 3: roadmap
§ Transport-layer services
§ Multiplexing and demultiplexing
§ Connectionless transport: UDP
§ Principles of reliable data transfer
• Alternating-bit protocol
• Pipelined protocols
§ Connection-oriented transport: TCP
§ TCP congestion control
§ Evolution of transport-layer
functionality
© From Computer Networking, by Kurose&Ross Transport Layer: 3-68
Pipelined protocols operation
pipelining: sender allows multiple, “in-flight”, yet-to-be-acknowledged
packets
• range of sequence numbers must be increased
• buffering at sender and/or receiver

© From Computer Networking, by Kurose&Ross Transport Layer: 3-69


Pipelining: increased utilization
sender receiver
first packet bit transmitted, t = 0
last bit transmitted, t = L / R

first packet bit arrives


RTT last packet bit arrives, send ACK
last bit of 2nd packet arrives, send ACK
last bit of 3rd packet arrives, send ACK
ACK arrives, send next
packet, t = RTT + L / R
3-packet pipelining increases
utilization by a factor of 3!

U 3L / R .0024
sender = = = 0.00081
RTT + L / R 30.008

© From Computer Networking, by Kurose&Ross Transport Layer: 3-70


Pipelined protocols: two generic forms
Go-back-N (GBN): Selective Repeat (SR):
§ Sender can have up to § Sender can have up to
N unacked packets in pipeline N unacked packets in pipeline
§ Receiver only sends cumulative ACKs § Receiver sends individual ACKs for
• cannot ACK pkt following a missing pkt each packet
§ Sender has timer for oldest unacked § Sender maintains specific timer for
pkt each unacked packet
• when timer expires, retransmit all • when timer expires, retransmit only that
unacked packets unacked packet

© From Computer Networking, by Kurose&Ross Transport Layer 3-71


Chapter 3: roadmap
§ Transport-layer services
§ Multiplexing and demultiplexing
§ Connectionless transport: UDP
§ Principles of reliable data transfer
• Alternating-bit protocol
• Pipelined protocols
• Go-Back-N
• Selective repeat
§ Connection-oriented transport: TCP
§ TCP congestion control
§ Evolution of transport-layer
functionality
© From Computer Networking, by Kurose&Ross Transport Layer: 3-72
Go-Back-N (GBN): sender
§ sender: “window” of up to N, consecutive transmitted but unACKed pkts
• k-bit seq # in pkt header

§ cumulative ACK: ACK(n): ACKs all packets up to, including seq # n


• on receiving ACK(n): move window forward to begin at n+1
§ single timer: conceptually for the oldest in-flight packet (i.e., sent but
unacked packet)
§ timeout(n): retransmit packet n and all higher seq # packets in window
© From Computer Networking, by Kurose&Ross Transport Layer: 3-73
Go-Back-N: sender extended FSM
rdt_send(data)
if (nextseqnum < base+N) {
sndpkt[nextseqnum] = make_pkt(nextseqnum,data,chksum)
udt_send(sndpkt[nextseqnum])
if (base == nextseqnum)
start_timer
nextseqnum++
}
L else
refuse_data(data)
base=1
nextseqnum=1
timeout
start_timer
Wait udt_send(sndpkt[base])
rdt_rcv(rcvpkt) udt_send(sndpkt[base+1])
&& corrupt(rcvpkt) …
udt_send(sndpkt[nextseqnum-1])
L rdt_rcv(rcvpkt) &&
not corrupt(rcvpkt)
base = getacknum(rcvpkt)+1
If (base == nextseqnum)
stop_timer
else
start_timer Transport Layer 3-74
© From Computer Networking, by Kurose&Ross
Go-Back-N: receiver extended FSM
default
udt_send(sndpkt) rdt_rcv(rcvpkt)
&& not corrupt(rcvpkt)
L && hasseqnum(rcvpkt,expectedseqnum)
expectedseqnum=1 Wait data = extract(rcvpkt)
sndpkt = deliver_data(data)
make_pkt(0,ACK,chksum) sndpkt = make_pkt(expectedseqnum,ACK,chksum)
udt_send(sndpkt)
expectedseqnum++

§ ACK-only: always send ACK for correctly-received packet with highest


in-order seq #
• need only remember expectedseqnum
§ out-of-order packet:
• discard (don’t buffer) -> no receiver buffering!
• re-ACK packet with highest in-order seq #
• will generate duplicate ACKs
© From Computer Networking, by Kurose&Ross
Transport Layer 3-75
Go-Back-N in action
sender window (N=4) sender receiver
012345678 send pkt0
012345678 send pkt1
receive pkt0, deliver, send ack0
012345678 send pkt2
send pkt3 X loss receive pkt1, deliver, send ack1
012345678
(wait)
receive pkt3, discard, (re)send ack1
012345678 rcv ack0, send pkt4
012345678 rcv ack1, send pkt5
receive pkt4, discard, (re)send ack1
ignore duplicate ACK receive pkt5, discard, (re)send ack1
pkt 2 timeout
012345678 send pkt2
012345678 send pkt3
012345678 send pkt4 receive pkt2, deliver, send ack2
012345678 send pkt5 receive pkt3, deliver, send ack3
receive pkt4, deliver, send ack4
receive pkt5, deliver, send ack5

© From Computer Networking, by Kurose&Ross


Transport Layer 3-76
Maximum window size with Go-Back-N
§ If seq# size = K (“The modulo”)
§ Q: What is the maximum window size N to preserve correctness?
• Obviously N cannot exceed K, why?
• Can N be equal to K?
Suppose K = 4, N =4
pkt0
pkt1 W=[0]
pkt2
pkt3 X W=[1]
X W=[2]
W=[0..3] X W=[3]
X
All ACKs lost
resend pkt0
W=[0]
resend pkt1
resend pkt2 All packets received in order,
resend pkt3
and delivered again to app!
Duplicates!

Transport Layer 3-77


Go-Back-N: maximum window size
Now with K = 4, N =3
pkt0
pkt1 W=[0]
pkt2
X W=[1]
X W=[2]
W=[0..2] X
All ACKs lost
resend pkt0 W=[3]
resend pkt1
resend pkt2 Receiver expects pkt3
All packets are now discarded!
And ACKs sent again

§ Constraint: window size (N) ≤ seq# size (K) – 1


§ It is necessary and sufficient to achieve correctness
when there is no packet reordering in the network
Transport Layer 3-78
Chapter 3: roadmap
§ Transport-layer services
§ Multiplexing and demultiplexing
§ Connectionless transport: UDP
§ Principles of reliable data transfer
• Alternating-bit protocol
• Pipelined protocols
• Go-Back-N
• Selective repeat
§ Connection-oriented transport: TCP
§ TCP congestion control
§ Evolution of transport-layer
functionality
© From Computer Networking, by Kurose&Ross Transport Layer: 3-79
Selective repeat (SR)
§receiver individually acknowledges all correctly received packets
• buffers packets, as needed, for eventual in-order delivery to upper
layer
§sender times-out/retransmits individually for unACKed packets
• sender maintains timer for each unACKed pkt
§sender window
• N consecutive seq #s
• limits seq #s of sent, unACKed packets

© From Computer Networking, by Kurose&Ross Transport Layer: 3-80


Selective Repeat (SR): sender, receiver
windows

© From Computer Networking, by Kurose&Ross Transport Layer 3-81


Relative positions of both windows
Initially: When the first packets have been received,
but their ACKs are not received (yet):
Sender: Sender:

Receiver: Receiver:

Are the following relative positions possible? Why?

Sender: Sender:

Receiver: Receiver:

Sender:

Receiver:

Transport Layer 3-82


Selective repeat: sender and receiver
sender receiver
data from above: packet n in [rcvbase, rcvbase+N-1]
§ if next available seq # in window, § send ACK(n)
send packet § out-of-order: buffer
timeout(n): § in-order: deliver (also deliver
buffered, in-order packets),
§ resend packet n, restart timer advance window to next not-yet-
ACK(n) in [sendbase,sendbase+N-1]: received packet
§ mark packet n as received packet n in [rcvbase-N,rcvbase-1]
§ if n smallest unACKed packet, § ACK(n)
advance window base to next otherwise:
unACKed seq # § ignore

Sender can lag behind receiver, but of at most N packets


© From Computer Networking, by Kurose&Ross Transport Layer: 3-83
Selective Repeat in action
sender window (N=4) sender receiver
012345678 send pkt0
012345678 send pkt1
012345678 send pkt2 receive pkt0, send ack0, deliver pkt0
012345678 send pkt3 Xloss receive pkt1, send ack1, deliver pkt1
(wait)
receive pkt3, buffer, send ack3
012345678 rcv ack0, send pkt4
012345678 rcv ack1, send pkt5
receive pkt4, buffer, send ack4
record ack3 arrived receive pkt5, buffer, send ack5

pkt 2 timeout
012345678 send pkt2
012345678 (but not 3,4,5)
012345678 rcv pkt2; send ack2;
012345678 deliver pkt2, pkt3, pkt4, pkt5;

Q: what happens when ack2 arrives?

© From Computer Networking, by Kurose&Ross Transport Layer: 3-84


Selective repeat:
sender window receiver window
(after receipt) (after receipt)

a dilemma!
0123012 pkt0
0123012 pkt1 0123012
0123012 pkt2 0123012

example:
0123012
0123012 pkt3
X
0123012
§ seq #s: 0, 1, 2, 3 (base 4 counting) pkt0 will accept packet
with seq number 0
§ window size=3 (a) no problem

0123012 pkt0
0123012 pkt1 0123012
0123012 pkt2 X 0123012
X 0123012
X
timeout
retransmit pkt0
0123012 pkt0
will accept packet
with seq number 0
(b) oops!
© From Computer Networking, by Kurose&Ross Transport Layer: 3-85
Selective repeat:
sender window receiver window
(after receipt) (after receipt)

a dilemma!
0123012 pkt0
0123012 pkt1 0123012
0123012 pkt2 0123012

example:
0123012
0123012 pkt3
X
§ seq #s: 0, 1, 2, 3 (base 4 counting) § receiver can’t
0123012
pkt0 will accept packet
see sender side with seq number 0
§ window size=3 (a) no problem
§ receiver
behavior
identical in both
cases!
§0something’s
123012 pkt0
Q: what relationship is needed 0(very)
1 2 3 0 1wrong!
2 pkt1 0123012

between sequence # size and 0123012 pkt2 X


X
0123012

window size to avoid problem


0123012
X
in scenario (b)? timeout
retransmit pkt0
0123012 pkt0
will accept packet
with seq number 0
(b) oops!
© From Computer Networking, by Kurose&Ross Transport Layer: 3-86
Maximum window size with SR
§ If seq# size = K (“The modulo”)
§ Q: What is the maximum window size N? Retransmissions of
received pkts fall
§ A: N ≤ K/2 outside rec window
• is proven correct when there is no packet reordering
Suppose K = 4, N =3 K = 4, but N =2
Sender 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3

Receiver 0 1 2 3 0 1 2 3 0 1 2 3 0 1 2 3

(a) (b) (c) (d)


(a) Initial situation with a window of size N=3.
(b) After 3 frames have been sent and received but not ACK’ed.
The upper side of the rec window falls in the sending window
(c) Initial situation with a window of size N=2.
(d) After 2 frames sent and received but not ACK’ed.
The upper side of the rec window does not fall in the sending window
Transport Layer 3-87
Maximum window size: general principle
§ Notations:
• seq# space = [0..K-1], i.e. modulo K
• Maximum sender window size = Ns
• Maximum receiver window size = Nr
§ Without packet reordering in network, protocol is correct
if and only if:
• Ns + Nr ≤ K
§ Particular cases:
• GBN: Nr = 1, Ns ≤ K - 1
• SR: Ns = Nr ≤ K/2
• Alternating-bit: K = 2, Ns = Nr = 1
• Special case of both GBN and Selective Repeat
3-88
GBN, when pkt or ACK reordering possible
With K = 4, N = 3 W=[0..2] W=[0]
pkt0
pkt1
pkt2
W=[1]
Ack0 W=[2]
resend pkt0 pkt reordering
W=[3]

W=[1..3]
pkt3

W=[0]
Duplicate!
but considered
as new pkt(0)!
Solution: Choose timeout so large that when a pkt is retransmitted the sender is sure that
the previous copy of this pkt and its ACK have disappeared from the network.
Better solution: Use a huge seq# space (K >>), keep N much smaller than K-1, and rely on
the underlying network to ensure packets and ACKs do not live too long Transport Layer 3-89
SR, when pkt or ACK reordering possible
K = 4, N = 2 W=[0..1] W=[0..1]
pkt0
pkt1

W=[1..2]
W=[2..3]
Ack0 pkt reordering
resend pkt0

W=[1..2]
pkt2

W=[3..0]
Duplicate!
but considered
as new pkt(0)!
Solution: Choose timeout so large that when a pkt is retransmitted the sender is sure that
the previous copy of this pkt and its ACK have disappeared from the network.
Better solution: Use a huge seq# space (K >>), keep N much smaller than K/2, and rely on
the underlying network to ensure packets and ACKs do not live too long Transport Layer 3-90
Chapter 3: roadmap
§ 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
§ TCP congestion control

© From Computer Networking, by Kurose&Ross Transport Layer: 3-91


TCP: overview RFCs: 793,1122, 2018, 5681, 7323
§ point-to-point: § cumulative ACKs
• one sender, one receiver § pipelining:
§ reliable, in-order byte • TCP congestion and flow control
stream: set window size
• no “message boundaries" § connection-oriented:
§ full duplex data: • handshaking (exchange of control
• bi-directional data flow in messages) initializes sender,
same connection receiver state before data exchange
• MSS: maximum segment size § flow controlled:
• sender will not overwhelm receiver

© From Computer Networking, by Kurose&Ross Transport Layer: 3-92


TCP segment structure
32 bits

source port # dest port # segment seq #: counting


ACK: seq # of next expected byte; sequence number bytes of data into bytestream
A bit: this is an ACK (not segments!)
acknowledgement number
length (of TCP header) head not
len used C E UAP R S F receive window flow control: # bytes
Internet checksum checksum Urg data pointer receiver willing to accept

options (variable length)


C, E: congestion notification
TCP options
application data sent by
RST, SYN, FIN: connection data application into
management (variable length) TCP socket

© From Computer Networking, by Kurose&Ross Transport Layer: 3-93


TCP sequence numbers, ACKs
outgoing segment from sender
Sequence numbers: source port # dest port #
sequence number
• byte stream “number” of acknowledgement number

first byte in segment’s data checksum


rwnd
urg pointer

window size
Acknowledgements: N

• seq # of next byte expected


from other side sender sequence number space

• cumulative ACK sent sent, not- usable not


ACKed yet ACKed but not usable
Q: how receiver handles out-of- (“in-flight”) yet sent

order segments outgoing segment from receiver

• A: TCP spec doesn’t say, - up


source port # dest port #
sequence number

to implementor acknowledgement number


A rwnd
checksum urg pointer

© From Computer Networking, by Kurose&Ross Transport Layer: 3-94


TCP sequence numbers, ACKs
Host A Host B

User types‘C’
Seq=42, ACK=79, data = ‘C’
host ACKs receipt
of‘C’, echoes back ‘C’
Seq=79, ACK=43, data = ‘C’
host ACKs receipt
of echoed ‘C’
Seq=43, ACK=80

simple telnet scenario


© From Computer Networking, by Kurose&Ross Transport Layer: 3-95
TCP Sender (simplified)
event: data received from event: timeout
application § retransmit segment that
caused timeout
§ create segment with seq #
§ restart timer
§ seq # is byte-stream number
of first data byte in segment
event: ACK received
§ start timer if not already
running § if ACK acknowledges
previously unACKed segments
• think of timer as for oldest
unACKed segment • update what is known to be
ACKed
• expiration interval:
TimeOutInterval • start timer if there are still
unACKed segments

© From Computer Networking, by Kurose&Ross Transport Layer: 3-96


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

Seq=100, 20 bytes of data


timeout

timeout
ACK=100
X
ACK=100
ACK=120

Seq=92, 8 bytes of data


SendBase=100 Seq=92, 8
bytes of data send cumulative
SendBase=120 ACK for 120
ACK=100
ACK=120

SendBase=120

lost ACK scenario premature timeout

© From Computer Networking, by Kurose&Ross Transport Layer: 3-97


TCP: retransmission scenarios
Host A Host B

Seq=92, 8 bytes of data

Seq=100, 20 bytes of data


ACK=100
X
ACK=120

Seq=120, 15 bytes of data

cumulative ACK covers


for earlier lost ACK

© From Computer Networking, by Kurose&Ross Transport Layer: 3-98


TCP Receiver: ACK generation [RFC 5681]
Event at receiver TCP receiver action
arrival of in-order segment with delayed ACK. Wait up to 500ms
expected seq #. All data up to (e.g. 200ms) for next segment.
expected seq # already ACKed If no next segment, send ACK
arrival of in-order segment with
expected seq #. One other immediately send single cumulative
segment has ACK pending ACK, ACKing both in-order segments

arrival of out-of-order segment immediately send duplicate ACK,


higher-than-expect seq #. indicating seq. # of next expected byte
Gap detected
arrival of segment that immediate send ACK, provided that
partially or completely fills gap segment starts at lower end of gap

© From Computer Networking, by Kurose&Ross Transport Layer: 3-99


TCP sender (simplified)
data received from application above
create segment, seq. #: NextSeqNum
pass segment to IP (i.e., “send”)
NextSeqNum = NextSeqNum + length(data)
L if (timer currently not running)
NextSeqNum = InitialSeqNum wait start timer
SendBase = InitialSeqNum for
event timeout
retransmit not-yet-acked
segment with smallest seq. #
start timer
ACK received, with ACK field value y
if (y > SendBase) {
SendBase = y
/* SendBase–1: last cumulatively ACKed byte */
if (there are currently not-yet-acked segments)
start timer
else stop timer
}
Transport Layer 3-100
© From Computer Networking, by Kurose&Ross
TCP fast retransmit
Host A Host B
TCP fast retransmit
if sender receives 3 additional
ACKs for same data (“triple Seq=92
Seq=1
, 8 byte
s of da
ta
duplicate ACKs”), resend unACKed 00, 20
bytes
of data
segment with smallest seq # X
§ likely that unACKed segment lost,
=100
so don’t wait for timeout ACK

=100

timeout
ACK
=100
ACK
=100
Receipt of three duplicate ACKs ACK

indicates 3 segments received Seq=100, 20 bytes of data

after a missing segment – lost


segment is likely. So retransmit
without waiting timeout!
© From Computer Networking, by Kurose&Ross Transport Layer: 3-101
Error recovery: TCP vs GBN vs SR
§ Like GBN
• TCP has cumulative ACKs
• TCP has a single retransmission timer
§ Like SR
• TCP has receiver buffer
• TCP only retransmits oldest unacked packet on time-out
• (TCP has a SACK option, similar to Selective Repeat)
§ In addition
• TCP has a Fast retransmit mechanism
• TCP has delayed ACKs

Transport Layer 3-102


Chapter 3: roadmap
§ 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
§ TCP congestion control

© From Computer Networking, by Kurose&Ross Transport Layer: 3-103


TCP flow control
application
Q: What happens if network Application removing
process
layer delivers data faster than data from TCP socket
buffers
application layer removes TCP socket
data from socket buffers? receiver buffers

TCP
code
Network layer
delivering IP packet
payload into TCP
IP
socket buffers
code

from sender

receiver protocol stack

© From Computer Networking, by Kurose&Ross Transport Layer: 3-104


TCP flow control
application
Q: What happens if network Application removing
process
layer delivers data faster than data from TCP socket
buffers
application layer removes TCP socket
data from socket buffers? receiver buffers

TCP
code

receive window
flow control: # bytes
receiver willing to accept IP
code

from sender

receiver protocol stack

© From Computer Networking, by Kurose&Ross Transport Layer: 3-105


TCP flow control
application
Q: What happens if network Application removing
process
layer delivers data faster than data from TCP socket
buffers
application layer removes TCP socket
data from socket buffers? receiver buffers

TCP
flow control code

receiver controls sender,


so sender won’t overflow IP
code
receiver’s buffer by
transmitting too much, too fast
from sender

receiver protocol stack

© From Computer Networking, by Kurose&Ross Transport Layer: 3-106


TCP flow control
§ TCP receiver “advertises” free buffer
space in rwnd field in TCP header to application process
• RcvBuffer size set via socket options
(typical default is 4096 bytes) RcvBuffer buffered data
• many operating systems autoadjust
rwnd free buffer space
RcvBuffer
§ sender limits amount of unACKed
(“in-flight”) data to received rwnd TCP segment payloads

§ guarantees receive buffer will not TCP receiver-side buffering


overflow

© From Computer Networking, by Kurose&Ross Transport Layer: 3-107


TCP flow control
flow control: # bytes receiver willing to accept

§ TCP receiver “advertises” free buffer


space in rwnd field in TCP header
• RcvBuffer size set via socket options
receive window
(typical default is 4096 bytes)
• many operating systems autoadjust
RcvBuffer
§ sender limits amount of unACKed
(“in-flight”) data to received rwnd
§ guarantees receive buffer will not
overflow
TCP segment format

© From Computer Networking, by Kurose&Ross Transport Layer: 3-108


Flow control: three improvements
1. Use larger windows:
• TCP throughput cannot exceed rwnd / RTT
• 16 bits in TCP header to encode rwnd
• max rwnd = 216 bytes, thus max TCP throughput = 64 Kbytes per RTT
• a TCP option (negotiated during TCP connection establishment) allows to
scale the window size by a factor 2k, with k ≤ 14, thus leading to
a max rwnd = 230 bytes (while there are 232 byte numbers)
2. Nagle: Reducing overhead by grouping bytes when sending app
writes one (or few) byte(s) at a time in socket
• See next slides
3. Silly window syndrome: reducing overhead when receiving app
reads one (or few) byte(s) at a time from socket
• See next slides

3-109
Nagle algorithm
§ When TCP receives data from socket one Host A Host B
byte at the time, or more generally in units
much smaller than the TCP Maximum a few bytes
Segment Size (MSS) small packet with few
a few bytes bytes received
• send small packet immediately, and buffer all the
rest until the outstanding bytes are acknowledged a few bytes Naggle does not allow
• send other segments only when all previous bytes to send other bytes
are acked (or when MSS bytes have been buffered, a few bytes (unless MSS is reached)
or when previous segment was full size) a few bytes
§ Useful for Telnet for example
Otherwise:
• 41-byte segments containing 1 byte of data packet with all buffered bytes
• 40 bytes of TCP/IP header overhead
§ Naggle can be disabled if needed
• See Socket options: TCP_NoDelay
3-110
Silly window syndrome
Still a problem with
Receiver’s buffer is full
applications reading one
byte at a time Application reads 1 byte

Room for one more byte

Header Window update segment sent

Header New byte arrives

1 Byte Receiver’s buffer is full

Clark's solution: receiver sends a window


update only if the buffer is half empty,
or if a full segment can be received
3-111
Chapter 3: roadmap
§ 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
§ TCP congestion control

© From Computer Networking, by Kurose&Ross Transport Layer: 3-112


TCP connection management
before exchanging data, sender/receiver “handshake”:
§ agree to establish connection (each knowing the other willing to establish connection)
§ agree on connection parameters (e.g., starting seq #’s, MSS, options)

application application

connection state: ESTAB connection state: ESTAB


connection variables: connection Variables:
seq # client-to-server seq # client-to-server
server-to-client server-to-client
rcvBuffer size rcvBuffer size
at server,client at server,client

network network

Socket clientSocket = Socket connectionSocket =


new Socket("hostname","port number"); welcomeSocket.accept();
© From Computer Networking, by Kurose&Ross Transport Layer: 3-113
Agreeing to establish a connection
2-way handshake:

Q: will 2-way handshake always


Let’s talk work in network?
ESTAB
ESTAB
OK § variable delays
§ retransmitted messages (e.g.
req_conn(x)) due to message loss
§ message reordering
choose x § can’t “see” other side
req_conn(x)
ESTAB
acc_conn(x)
ESTAB

© From Computer Networking, by Kurose&Ross Transport Layer: 3-114


2-way handshake scenarios

choose x
req_conn(x) No problem!
ESTAB
acc_conn(x)

ESTAB
data(x+1) accept
ACK(x+1) data(x+1)

connection
x completes

© From Computer Networking, by Kurose&Ross Transport Layer: 3-115


2-way handshake scenarios

choose x
req_conn(x)
ESTAB
retransmit acc_conn(x)
req_conn(x)

ESTAB
req_conn(x)

connection
client x completes server
terminates forgets x

Problem: half open


ESTAB
connection! (no client)
acc_conn(x)

© From Computer Networking, by Kurose&Ross Transport Layer: 3-116


2-way handshake scenarios

choose x
req_conn(x)
ESTAB
retransmit acc_conn(x)
req_conn(x)

ESTAB
data(x+1) accept
data(x+1)
retransmit
data(x+1)
connection
x completes server
client
terminates forgets x
req_conn(x)
ESTAB
data(x+1)
Problem: duplicate data
accept
data(x+1) accepted!

© From Computer Networking, by Kurose&Ross


TCP 3-way handshake
SYN has a seq number: kind of fictitious first byte

client state server state


CLOSED LISTEN
choose init seq num, x
send TCP SYN msg
SYNSENT without data;
start timer for
SYNbit=1, Seq=x
choose init seq num, y
SYN retransmission send TCP SYNACK
msg, acking SYN SYN RCVD
SYNbit=1, Seq=y
ACKbit=1; ACKnum=x+1
received SYNACK(x+1)
indicates server is live;
ESTAB send ACK for SYNACK;
this segment may contain ACKbit=1, ACKnum=y+1
client-to-server data
with Seq=x+1 received ACK(y+1)
indicates client is live;
allocate buffer ESTAB

If server port not open,


TCP server sends back a RST segment
© From Computer Networking, by Kurose&Ross
Transport Layer 3-118
TCP 3-way handshake is robust
Notations:

choose x SYN(x) means SYNbit = 1 and Seq = x


SYN(x)
choose y SYNACK(y,x) means SYNbit = 1 and
Retransmit SYNACK(y, x+1) Seq = y and ACKbit = 1 and ACKnum = x
SYN(x)
ESTAB ACK(y) means ACKbit = 1 and ACKnum = y
ACK(y+1) accept
retransmit and data(x+1) data(x+1) ESTAB
data(x+1)
connection
completes
client server
terminates SYN(x) forgets x

ACK(y+1) choose y’, must not have been used in recent past!
and data(x+1) (Here “recent” means a maximum packet life time)
Reject ACK: y ≠ y’
SYNACK(y’, x+1)

Transport Layer 3-119


TCP: choosing initial 32-bit seq#
Choosing x and y:
client server § Constraint: x and y not used recently in a
former connection between this client
connect SYN (s listen (i.e. same IP and port#) and this server
e q = x) (same IP and port#)
+ accept
+ 1) § Recently = less than TCP maximum
= x
e q = y, ack segment lifetime (MSL)
CK ( s
SYNA § Otherwise a still alive duplicate segment
ACK (s (of SYN, SYNACK, ACK) from a former
connected e q = x+ connection could be confused with this
1 , a c k=
y+ 1 ) connection
connected § In practice, same client port# cannot be
reused sooner than 2 MSL for a new
connection (see later)
§ So, any x and y are possible
§ In practice, x and y are picked at random
by TCP (useful for security reason)
3-120
TCP 3-way handshake: FSM
server side
closed client side

Socket connectionSocket =
welcomeSocket.accept();
L
SYN(x) Socket clientSocket =
SYNACK(seq=y,ACKnum=x+1) new Socket("hostname","port number");
create new socket for listen SYN(seq=x)
communication back to client

SYN SYN
rcvd sent

SYNACK(seq=y,ACKnum=x+1)
ESTAB ACK(ACKnum=y+1)
ACK(ACKnum=y+1)
L

© From Computer Networking, by Kurose&Ross


Transport Layer 3-121
Closing a TCP connection
§ client, server each close their side of connection
• send TCP segment with FIN bit = 1
• symmetric/graceful release
§ respond to received FIN with ACK
• on receiving FIN, ACK can be combined with own FIN
§ simultaneous FIN exchanges can be handled

© From Computer Networking, by Kurose&Ross Transport Layer: 3-122


TCP: closing a connection
Last data from client (possibly empty)
client state server state
ESTAB ESTAB
clientSocket.close()
FIN_WAIT_1 app can no longer FINbit=1, seq=x
send but can CLOSE_WAIT
receive data
ACKbit=1; ACKnum=x+1 app can still
FIN_WAIT_2 wait for server send data
close
clientSocket.close()
LAST_ACK
FINbit=1, seq=y
TIMED_WAIT app can no longer
send data
ACKbit=1; ACKnum=y+1
timed wait for 2 * max
segment lifetime (MSL); CLOSED
will respond with ACK
to received FINs FINs have (cumulative) seq# to recover loss of last data bytes
CLOSED ACKs are sent when all data received. So there are
also retransmissions when FINs are not acked Transport Layer
© From Computer Networking, by Kurose&Ross 3-123
Closing a TCP connection: FSM
active close connectionSocket.close() FIN passive close
FIN ACK
ESTAB

FIN
WAIT FIN
ACK 1
ACK simultaneous CLOSE
L WAIT
close

FIN FIN+ACK
WAIT CLOSING connectionSocket.close()
2 ACK All pending data are
still sent reliably FIN
FIN ACK LAST
ACK TIME L ACK After a socket “close”,
WAIT
ACK TCP continues to send
Wait 2 * MSL
close socket the previous bytes reliably
close socket CLOSED

Side that actively closes socket waits a double MSL (safety margin). Therefore same TCP 4-tuple cannot be reused
sooner (e.g. with same client port#). It ensures that no duplicate segment from an earlier connection with the same
4-tuple can jump in the current connection. Transport Layer 3-124
Chapter 3: roadmap
§ Transport-layer services
§ Multiplexing and demultiplexing
§ Connectionless transport: UDP
§ Principles of reliable data transfer
§ Connection-oriented transport: TCP
§ TCP congestion control
§ Evolution of transport-layer
functionality

© From Computer Networking, by Kurose&Ross Transport Layer: 3-125


Principles of congestion control
Congestion:
§ informally: “too many
sources sending too much
data too fast for network
to handle” flow control: one sender congestion control:
too fast for one receiver too many senders,
§ manifestations: sending too fast
• long delays (queueing Transmission
in router buffers) rate adjustment
• packet loss (buffer Transmission Internal
overflow at routers) network congestion

§ different from flow control!


Large-capacity
§ a top-10 problem! Small-capacity receiver
receiver
© From Computer Networking, by Kurose&Ross Transport Layer: 3-126
Approaches towards congestion control

End-end congestion control:


§ no explicit feedback from
network
§ congestion inferred from ACKs
data data
observed loss, delay ACKs

§ approach taken by TCP

© From Computer Networking, by Kurose&Ross Transport Layer: 3-127


Approaches towards congestion control
Network-assisted congestion
control:
§ routers provide direct feedback explicit congestion info

to sending/receiving hosts with


flows passing through congested ACKs
data data
router ACKs

§ may indicate congestion level or


explicitly set sending rate
§ TCP ECN, ATM, DECbit protocols
§ Network-assisted congestion control not studied in this course
© From Computer Networking, by Kurose&Ross Transport Layer: 3-128
TCP congestion control: AIMD
§ approach: senders can increase sending rate until packet loss
(congestion) occurs, then decrease sending rate on loss event
Additive Increase Multiplicative Decrease
increase sending rate by 1 cut sending rate in half at
maximum segment size (MSS) each loss event
every RTT until loss detected
TCP sender Sending rate

AIMD sawtooth
behavior: probing
for bandwidth

© From Computer Networking, by Kurose&Ross time Transport Layer: 3-129


TCP AIMD: more
Multiplicative decrease detail: sending rate is (in TCP Reno version)
§ cut in half on loss detected by triple duplicate ACK (DUPACK)
§ Mild congestion: isolated packet loss, next packets received
§ Note: can only work if cwnd ≥ 4 MSS
§ cut to 1 MSS (maximum segment size) per RTT on loss detected by
timeout
§ Thus when 3 DUPACK not received: more severe congestion
Why AIMD?
§ AIMD – a distributed, asynchronous algorithm – has been shown to:
• optimize congested flow rates network wide!
• have desirable stability properties
© From Computer Networking, by Kurose&Ross Transport Layer: 3-130
TCP’s congestion window (cwnd)
sender sequence number space
cwnd TCP sending behavior:
§ roughly: send cwnd bytes,
wait RTT for ACKS, then
send more bytes
last byte
cwnd
ACKed sent, but not- available but
TCP rate ~
~ bytes/sec
yet ACKed not used RTT
(“in-flight”) last byte sent

§ TCP sender limits transmission: LastByteSent – LastByteAcked ≤ cwnd


§ cwnd is dynamically adjusted in response to observed network
congestion (implementing TCP congestion control)
© From Computer Networking, by Kurose&Ross Transport Layer: 3-131
TCP slow start
cwnd
Host A Host B
§ when connection begins,
increase rate exponentially
until first loss event: 1 one segm
ent

RTT
• initially cwnd = 1 MSS
(Maximum Segment Size) 2 two segme
nts
• double cwnd every RTT
• done by incrementing cwnd 3 four segm
for every ACK received 4 ents

§ summary: initial rate is


slow, but ramps up
exponentially fast time

© From Computer Networking, by Kurose&Ross Transport Layer: 3-132


TCP: from slow start to congestion
avoidance
Q: when should the exponential
increase switch to linear?
When 3 DUPACK
X
A: when cwnd gets to 1/2 of its
value before timeout
Implementation:
When T.O.
§ variable ssthresh
§ on loss event, ssthresh is set to
1/2 of cwnd just before loss event

Implementation of additive increase in congestion avoidance phase:


§ linear growth: cwnd = cwnd + (MSS/cwnd)MSS, for each ACK received
© From Computer Networking, by Kurose&Ross Transport Layer: 3-133
Summary: TCP congestion control
New
New ACK!
duplicate ACK
dupACKcount++
ACK!
new ACK
new ACK
.
cwnd = cwnd + MSS (MSS/cwnd)
dupACKcount = 0
cwnd = cwnd+MSS transmit new segment(s), as allowed
dupACKcount = 0
L transmit new segment(s), as allowed
cwnd = 1 MSS
ssthresh = 64 KB cwnd > ssthresh
dupACKcount = 0 slow L congestion
start timeout avoidance
ssthresh = cwnd/2
cwnd = 1 MSS AIMD duplicate ACK
timeout dupACKcount = 0 dupACKcount++
ssthresh = cwnd/2 retransmit missing segment
cwnd = 1 MSS
dupACKcount = 0
retransmit missing segment New
timeout ACK!
ssthresh = cwnd/2
cwnd = 1 New ACK
dupACKcount = 0
cwnd = ssthresh dupACKcount == 3
dupACKcount == 3 retransmit missing segment dupACKcount = 0
ssthresh= cwnd/2 ssthresh= cwnd/2
cwnd = ssthresh + 3 cwnd = ssthresh + 3
retransmit missing segment
fast retransmit missing segment

recovery
duplicate ACK
cwnd = cwnd + MSS
transmit new segment(s), as allowed

© From Computer Networking, by Kurose&Ross Transport Layer: 3-134


TCP “goodput” in steady state
§ Goodput = useful throughput, i.e. not counting headers and retransmitted bytes
§ Steady state = congestion level stable in network
§ What’s the average goodput of TCP as a function of window size and RTT?
• Ignoring slow start
§ Let W be the window size (measured in MSS) when losses occur
§ When window is W, goodput is W/RTT
§ Just after loss, window drops to W/2, goodput to 0.5 W/RTT
§ Average goodput: 0.75 W/RTT
W
Window size in MSS

3W/4 . W/2
MSS per
W/2 cycle
W/2 . RTT Transport Layer: 3-135
TCP goodput in steady state (2)
§ Average window size (in MSS) = 3W/4
§ Number of MSS per cycle = 3W/4 . W/2 = 3W2/8
§ If we assume one packet loss per cycle, we have p = 1 / (3W2/8)
• where p is the packet loss ratio

§ So

§ Average goodput (in MSS/sec) = average window / RTT = 3W / 4RTT

§ Average TCP goodput (in bps)


Transport Layer: 3-136
TCP Futures: TCP over “long, fat pipes”
§ Example: 1500-byte segments, 100ms RTT, want 10 Gbps goodput
§ Requires average window size W = 83333 in-flight segments!
• How was this value of W calculated?
§ Goodput in terms of loss rate:

§ Needs packet loss rate p = 2 . 10-10 Very small !


§ New versions of TCP for high-speed needed!
Transport Layer: 3-137
TCP fairness
Fairness goal: if K TCP sessions share same bottleneck link of
capacity R, each should have average rate of R/K
TCP connection 1

bottleneck
TCP connection 2 router
capacity R

© From Computer Networking, by Kurose&Ross Transport Layer: 3-138


Q: is TCP Fair?
Example: two competing TCP sessions:
§ additive increase gives slope of 1, as throughout increases
§ multiplicative decrease decreases throughput proportionally

R equal bandwidth share


Is TCP fair?
Connection 2 throughput

A: Yes, under idealized


loss: decrease window by factor of 2 assumptions:
congestion avoidance: additive increase § same RTT
loss: decrease window by factor of 2
congestion avoidance: additive increase § fixed number of sessions
only in congestion
avoidance

Connection 1 throughput R
© From Computer Networking, by Kurose&Ross Transport Layer: 3-139
And when RTTs are different?
§ If RTT of connection 2 = 2 x RTT of connection 1
§ Connection 1 ramps up twice more quickly

bottleneck capacity share is


Connection 2 throughput

inversely proportional to RTT

TCP goodput:

Connection 1 throughput R

© From Computer Networking, by Kurose&Ross 3-140


Fairness: must all network apps be “fair”?
Fairness and UDP Fairness and parallel TCP
§ multimedia apps often do not connections
use TCP § application can open multiple
• do not want rate throttled by
congestion control parallel connections between two
hosts
§ instead use UDP:
• send audio/video at constant rate, § web browsers do this , e.g., link of
tolerate packet loss rate R with 9 existing connections:
• UDP is not “TCP friendly” • new app asks for 1 TCP, gets rate R/10
§ there is no “Internet police” • new app asks for 9 // TCPs, gets R/2
policing use of congestion
control

© From Computer Networking, by Kurose&Ross Transport Layer: 3-141


Transport layer: roadmap
§ Transport-layer services
§ Multiplexing and demultiplexing
§ Connectionless transport: UDP
§ Principles of reliable data transfer
§ Connection-oriented transport: TCP
§ TCP congestion control
§ Evolution of transport-layer
functionality

© From Computer Networking, by Kurose&Ross Transport Layer: 3-142


Evolving transport-layer functionality
§ TCP, UDP: principal transport protocols for 40 years
§ different “flavors” of TCP developed, for specific scenarios:
Scenario Challenges
Long, fat pipes (large data Many packets “in flight”; loss shuts down
transfers) pipeline
Wireless networks Loss due to noisy wireless links, mobility;
TCP treats this as congestion loss
Long-delay links Extremely long RTTs
Data center networks Latency sensitive
Background traffic flows Low priority, “background” TCP flows

§ moving transport-layer functions to application layer, on top of UDP


• HTTP/3: QUIC
© From Computer Networking, by Kurose&Ross Transport Layer: 3-143
QUIC: Quick UDP Internet Connections
§ application-layer protocol, on top of UDP
• increase performance of HTTP
• deployed on many Google servers, apps (Chrome, mobile YouTube app)

HTTP/2 HTTP/2 (slimmed)


Application HTTP/3
TLS QUIC

Transport TCP UDP

Network IP IP

HTTP/2 over TCP HTTP/2 over QUIC over UDP

© From Computer Networking, by Kurose&Ross Transport Layer: 3-144


QUIC: Quick UDP Internet Connections
adopts approaches we’ve studied in this chapter for
connection establishment, error control, congestion control
• error and congestion control: “Readers familiar with TCP’s loss
detection and congestion control will find algorithms here that parallel
well-known TCP ones” [from QUIC specification]
• connection establishment: reliability, congestion control,
authentication, encryption, state established in one RTT!

§ multiple application-level “streams” multiplexed over single QUIC


connection
• separate reliable data transfer, security
• common congestion control
© From Computer Networking, by Kurose&Ross Transport Layer: 3-145
QUIC: Connection establishment

TCP handshake
(transport layer) QUIC handshake

data
TLS handshake
(security)
data

TCP (reliability, congestion control state) QUIC: reliability, congestion control,


+ TLS (authentication, crypto state) authentication, crypto state
§ 2 serial handshakes § 1 handshake

© From Computer Networking, by Kurose&Ross Transport Layer: 3-146


QUIC: streams: parallelism, no HOL blocking
HTTP HTTP
GET GET HTTP
GET
HTTP HTTP
application

GET GET
HTTP
GET QUIC QUIC QUIC QUIC QUIC QUIC
encrypt encrypt encrypt encrypt encrypt
encrypt
QUIC QUIC QUIC
TLS encryption TLS encryption RDT RDT RDT error! QUIC
QUIC QUIC
RDT RDT RDT

QUIC Cong. Cont. QUIC Cong. Cont.


TCP RDT TCP
error! RDT
transport

TCP Cong. Contr. TCP Cong. Contr. UDP UDP

(a) HTTP 1.1 and HTTP/2 with TCP and TLS (b) HTTP/3: HTTP/2 with QUIC: no HOL blocking

© From Computer Networking, by Kurose&Ross Transport Layer: 3-147


Chapter 3: summary
§ principles behind transport Up next:
layer services: § leaving the network
• multiplexing, demultiplexing “edge” (application,
• reliable data transfer transport layers)
• flow control § into the network “core”
• congestion control
§ two network-layer
§ instantiation, implementation chapters:
in the Internet • data plane
• UDP • control plane
• TCP

© From Computer Networking, by Kurose&Ross Transport Layer: 3-148

You might also like