Transport Layer Protocols Overview
Transport Layer Protocols Overview
Summer 2023
Chapter 3
Transport Layer
(Sec – 3.1, 3.2, 3.3, 3.4,
3.5 & 3.7)
Notes derived from “Computer Networking: A Top
Down Approach”, Jim Kurose, Keith Ross,
Addison-Wesley.
Computer
Slides are adapted from the companion web site of Networking: A Top
the book, as modified Down Approach
by Prof. Dr. A.K.M. Muzahidul Islam. 7th edition
Jim Kurose, Keith Ross
Addison-Wesley
March 2017
Introduction 1-2
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
log
ica
Transport Layer Protocols are implemented
l en
in the End Systems, NOT in Network Routers
d-e
nd
local or
Transport protocols actions in end systems:
t
ran
regional
ISP
• Sender: breaks application messages into
spor
segments, passes to network layer home network content
t
provider
• Receiver: reassembles segments into messages, network
applicatio
datacenter
network
passes to application layer n
transport
Two transport protocols available to Internet network
data link
applications physical
log
• reliable, in-order delivery
ica
l en
• congestion control
d-e
• flow control
nd
local or
t
ran
regional
• connection setup ISP
spor
home network
UDP: User Datagram Protocol content
t
provider
network datacenter
• unreliable, unordered delivery applicatio
n
transport
network
• delay guarantees
• bandwidth guarantees
Transport Layer Actions
Sender:
application is passed an application- app. msg
application
layer message
transport
determines segment TTh htransport
app. msg
header fields values
network (IP)
creates segment network (IP)
link
passes segment to IP link
physical physical
Receiver:
application receives segment from IP application
checks header values
app. msg
transport extracts application-layer transport
message
network (IP) demultiplexes message up network (IP)
physical physical
Th app. msg
application
• Multiplexing : The job of gathering data chunks at the source host from
different sockets, encapsulating each data chunk with header information to
create segments and passing the segments to the network layer.
application application
transport transport
(UDP) (UDP)
link link
physical physical
network (IP)
creates UDP segment network (IP)
link
passes segment to IP link
physical physical
network
UDP h SNMP(IP)
msg message network (IP)
demultiplexes message up
link to application via socket link
physical physical
data to/from
UDP segment format application layer
• Transmitting Side
1100 0010
0010 0010
+ 1100 ------
1000 0100
Flip -> 1011
---------------
(Checksum)
0010 0010
• Receiving Side 0010
0010 0010 1101
------
+ 1011 (Checksum)
1111
---------------------- Flip -> 0000
0010 1101 (Correct)
CRC Example
Send • Receive
• M(x) = 110011 x5+x4+x+1 (6 bits)
• P(x) = 11001 x4+x3+1 (5 bits, n = 4) 11001 1100111001
4 bits of redundancy 11001
• Form xnM(x) 110011 0000
x9+x8+x5+x4 11001
• Divide xnM(x) by P(x) to find C(x)
11001
100001 00000
11001 1100110000
11001
10000
No remainder
11001 Accept
1001= C(x)
Send the block 110011 1001
3.4 Principles of reliable data transfer
sending receiving
process process
application dat dat
transport a a
reliable channel
transport
network
unreliable channel
reliable service implementation
sending receiving
process process
application dat dat
transport a a
sender-side of receiver-side
However, reliable data
transfer protocol
of reliable data
transfer protocol
The Complexity of reliable data
transfer protocol will depend transport
network
(strongly) on characteristics of unreliable channel
unreliable channel (lose,
reliable service implementation
corrupt, reorder data?)
Transport Layer: 3-24
Principles of reliable data transfer
sending receiving
process process
application dat dat
transport a a
sender-side of receiver-side
reliable data of reliable data
Sender, receiver do not know transfer protocol 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
Figure indicates only Unidirectional i.e. data transfer from the sending to the receiving side.
• Bi-directional : data transfer from both sending and receiving sides.
Reliable Data Transfer over a Perfectly
Reliable Channel: rdt1.0
• The sender will not send a new piece of data until it is sure that the
receiver has correctly received the current packet.
• Because of this behavior, protocols such as rdt2.0 are known as stop-
and-wait protocols.
• When the sender is in the wait-for-ACK-or-NAK state, it cannot get
more data from the upper layer; that is, the rdt_send() event occurs
after the sender receives an ACK.
• Sender send a new piece of data iff receiver has correctly received the
current packet. Thus, rdt2.0 is known as stop-and-wait protocols.
Reliability in action (Stop-and-Wait)
• The sender does not know whether a data packet was lost, an ACK was
lost, or if the packet or ACK was simply overly delayed.
• In all cases, the action is the same: retransmit.
• Time-based retransmission mechanism requires a countdown timer.
• The sender will need to (1) start the timer each time a packet is sent
• (2) respond to a timer interrupt
• (3) stop the timer.
sender receiver sender receiver
send pkt0 pkt0 send pkt0 pkt0
rcv pkt0 rcv pkt0
ack send ack0 ack0 send ack0
rcv ack0 0 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
sender receiver
sender receiver send pkt0
pkt0
rcv pkt0
send pkt0 pkt0 send ack0
ack
rcv pkt0 rcv ack0
send ack0 send pkt1 0
ack pkt
rcv ack0 0 1 rcv pkt1
send pkt1 pkt send ack1
1 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 pkt
1
U 3L / R .0024
sender = = = 0.00081
RTT + L / R 30.008
pipeline.
Selective Repeat in action – Pipeline Protocol
When the sender window (N=4) sender receiver
window size and 012345678 send pkt0
bandwidth-delay 012345678 send pkt1
012345678 send pkt2 receive pkt0, send ack0
product are both 012345678 send pkt3 Xloss receive pkt1, send ack1
large, many (wait)
receive pkt3, buffer,
packets can be 012345678 rcv ack0, send pkt4 send ack3
in the pipeline. 012345678 rcv ack1, send pkt5
receive pkt4, buffer,
A single packet record ack3 arrived send ack4
receive pkt5, buffer,
error can thus pkt 2 timeout send ack5
cause GBN to 012345678 send pkt2
(but not 3,4,5)
012345678
retransmit a 012345678 rcv pkt2; deliver pkt2,
pkt3, pkt4, pkt5; send ack2
large number of 012345678
packets, many
Q: what happens when ack2 arrives?
unnecessarily. Transport Layer
3.5 TCP: overview RFCs: 793,1122, 2018, 5681, 7323
application
• Multiplexing : The job of gathering data chunks at the source host from
different sockets, encapsulating each data chunk with header information to
create segments and passing the segments to the network layer.
segments
• A: TCP spec doesn’t say, - up to
implementor
TCP sequence numbers, ACKs
Suppose, Host A initiates a Telnet session with Host B.
Host A initiates the session - client, and Host B - server.
The starting sequence numbers are 42 and 79 for the client and server.
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’ The acknowledgment
Seq=43, ACK=80
number is the sequence
number of the next byte.
simple telnet scenario
Transport Layer: 3-47
TCP Sender (simplified)
• There are 03 major events related to data transmission and retransmission in
the TCP sender:
• data received from application above;
• timer timeout; and
• ACK receipt.
timeout
sending this segment, Host A ACK=100
waits for a segment from B with X
acknowledgment number 100.
• Although the segment from A is
received at B, the Seq=92, 8 bytes of data
acknowledgment from B to A
gets lost. In this case, the ACK=100
timeout event occurs, and Host A
retransmits the same segment.
lost ACK scenario
Transport Layer: 3-49
TCP: retransmission scenarios
• Host A sends two segments back to back. The first
Host A Host B
segment has sequence number 92 and 8 bytes of
data, and the second segment has sequence
number 100 and 20 bytes of data.
• SendBase=92
Suppose that both segments arrive intact at B, and
Seq=92, 8 bytes of data
B sends two separate acknowledgments for each
timeout
of these segments. Seq=100, 20 bytes of data
buffers?
TCP
code
Network layer
delivering IP datagram
payload into TCP
IP
socket buffers
code
from sender
buffers?
TCP
code
Network layer
delivering IP datagram
payload into TCP
IP
socket buffers
code
from sender
buffers?
TCP
code
receive window
flow control: # bytes
receiver willing to accept IP
code
from sender
buffers?
TCP
flow control code
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
Network-assisted congestion
control: explicit congestion info
router
may indicate congestion level or
explicitly set sending rate
TCP ECN, ATM, DECbit protocols
Transport Layer: 3-64
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 every each loss event
RTT until loss detected
TCP sender Sending rate
AIMD sawtooth
behavior: probing
for bandwidth
RTT
• initially cwnd = 1 MSS two segm
ents
• double cwnd every RTT
• done by incrementing four segm
cwnd for every ACK ents
Implementation:
variable ssthresh
on loss event, ssthresh is set to
1/2 of cwnd just before loss event
* Check out the online interactive exercises for more examples: h ttp://[Link]/kurose_ross/interactive/
Transport Layer: 3-68
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 for next segment. If no next segment,
expected seq # already ACKed send ACK
Introduction 70