Transport Layer - Part 1
Transport Layer - Part 1
Transport Layer
Computer Networking: A
Top-Down Approach
8th edition
Jim Kurose, Keith Ross
Pearson, 2020
Transport Layer: 3-1
Transport services and protocols
application
transport
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)
physical physical
Receiver:
application ▪ receives segment from IP application
▪ checks header values
transport
app. msg ▪ extracts application-layer transport
message
network (IP) network (IP)
▪ demultiplexes message up
link to application via socket link
physical physical
Th app. msg
• congestion control
• flow control
• connection setup
local or
▪ UDP: User Datagram Protocol regional ISP
application
Hnnetwork
Ht HTTP msg transport
transport
Hn Hnetwork
t HTTP msg
link network
link physical link
physical physical
Hn Ht HTTP msg
client
application application
HTTP msg
HTTP msg transport
Ht HTTP msg
de-multiplexing
application
? transport
de-multiplexing
Demultiplexing
multiplexing
application
transport
multiplexing
Multiplexing
How demultiplexing works
▪ host receives IP datagrams 32 bits
• each datagram has source IP source port # dest port #
address, destination IP address
• each datagram carries one other header fields
transport-layer segment
• each segment has source, application
destination port number data
▪ host uses IP addresses & port (payload)
numbers to direct segment to
appropriate socket TCP/UDP segment format
application
application application
P1
P3 P4
transport
transport transport
network
network link network
link physical link
physical physical
B D
source port: 6428 source port: ?
dest port: 9157 dest port: ?
A C
source port: 9157 source port: ?
dest port: 6428 dest port: ?
Connection-oriented demultiplexing
▪ TCP socket identified by ▪ server may support many
4-tuple: simultaneous TCP sockets:
• source IP address • each socket identified by its
• source port number own 4-tuple
• dest IP address • each socket associated with
• dest port number a different connecting client
▪ demux: receiver uses all
four values (4-tuple) to
direct segment to
appropriate socket
Transport Layer: 3-21
Connection-oriented demultiplexing: example
application
application P4 P5 P6 application
P1 P2 P3
transport
transport transport
network
network link network
link physical link
physical server: IP physical
address B
application application
transport transport
(UDP) (UDP)
link link
physical physical
physical physical
data to/from
UDP segment format application layer
Transmitted: 5 6 11
Received: 4 6 11
receiver-computed sender-computed
checksum
= checksum (as received)
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
* Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/
Transport Layer: 3-34
Internet checksum: weak protection!
example: add two 16-bit integers
0 1
1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 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 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!
transport
network
unreliable channel
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
sending receiving
process process
application data data
transport
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
pkt0
(after receipt)
a dilemma!
0123012
0123012 pkt1 0123012
0123012 pkt2 0123012
0123012
example: 0123012 pkt3
X
▪ seq #s: 0, 1, 2, 3 (base 4 counting)
0123012
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!
Transport Layer: 3-59
Selective Repeat – Summary
Selective repeat protocol allows the receiver to accept and buffer the frames following a
damaged or lost one. Selective Repeat attempts to retransmit only those packets that are
actually lost.
▪ Sender window size Ws = N
▪ Receiver window size Wr = N
▪ Sequence Number ≥ N + N
▪ Uses only independent acknowledgement
▪ Can Accept out of order packets
▪ Packet Loss ? Resend only the lost packet after timeout
▪ Acknowledgement loss ? Resend if not receive before timeout
▪ ADV: Provides efficient transmission of packets, Only lost packets are retransmitted,
reducing network congestion
▪ DISADV: Requires more memory and processing power
Suppose the sender in Selective Repeat ARQ has a window size of 4 and the receiver also has a window
size of 4. The sender transmits packets 1, 2, 3, and 4, but packet 2 is lost. What happens next? Describe
the behavior of both sender and receiver.
In Selective Repeat ARQ, if an ACK is lost due to network issues, what happens? How does the
sender ensure reliable transmission?
Sender window size of Go-Back-N Protocol is N. Sender window size of selective Repeat protocol is also N.
Receiver window size of Go-Back-N Protocol is 1. Receiver window size of selective Repeat protocol is N.
Go-Back-N Protocol is less complex. Selective Repeat protocol is more complex.
In Go-Back-N Protocol, neither sender nor at receiver need In selective Repeat protocol, receiver side needs sorting to
sorting. sort the frames.
In Go-Back-N Protocol, type of Acknowledgement is In selective Repeat protocol, type of Acknowledgement is
cumulative. individual.
In Go-Back-N Protocol, Out-of-Order packets are NOT
In selective Repeat protocol, Out-of-Order packets are
Accepted (discarded) and the entire window is re-
Accepted.
transmitted.
In selective Repeat protocol, if Receives a corrupt packet, it
In Go-Back-N Protocol, if Receives a corrupt packet, then
immediately sends a negative acknowledgement and hence
also, the entire window is re-transmitted.
only the selective packet is retransmitted.
Efficiency of Go-Back-N Protocol is Efficiency of selective Repeat protocol is also
N/(1+2*a) N/(1+2*a) Transport Layer: 3-62
Stop-and-Wait Protocol Sliding Window Protocol
In sliding window protocol, sender sends more than one frame
In Stop-and-Wait Protocol, sender sends one frame and wait
to the receiver side and re-transmits the frame(s) which is/are
for acknowledgment from receiver side.
damaged or suspected.
Efficiency of Stop-and-Wait Protocol is worse. Efficiency of sliding window protocol is better.
Sender window size of Stop-and-Wait Protocol is 1. Sender window size of sliding window protocol is N.
Receiver window size of Stop-and-Wait Protocol is 1. Receiver window size of sliding window protocol may be 1 or N.
In sliding window protocol, sorting may be or may not be
In Stop-and-Wait Protocol, sorting is not necessary.
necessary.
Efficiency of Stop-and-Wait Protocol is 1/(1+2*a) Efficiency of sliding window protocol is N/(1+2*a)
Stop-and-Wait Protocol is mostly used in low speed and error Sliding window protocol is mostly used in high speed and error-
free network. prone network.
In Stop-and-Wait Protocol, the sender cannot send any new In sliding window protocol, the sender can continue to send
frames until it receives an acknowledgment for the previous new frames even if some of the earlier frames have not yet
frame. been acknowledged.
Stop-and-Wait Protocol has a lower throughput as it has a lot of Sliding window protocol has a higher throughput as it allows for
idle time while waiting for the acknowledgment. continuous transmission of frames.