Transport Layer - 3.1&3.2
Transport Layer - 3.1&3.2
Transport Layer
.
Chapter 3: Outline
1. INTRODUCTION
2. TRANSPORT-LAYER PROTOCOLS
Process-to-Process Communication
ICANN Ranges
We l l - k n o w n p o r t s
Registered ports
Dynamic ports
Flow Control
Pushing or Pulling
Flow Control at Transport Layer
Buffers
Error Control
Sequence Numbers
Acknowledgment
Combination of Flow and Error Control
Sliding Window
3.1.1 (continued)
Congestion Control
application
l
Multiple transport protocol transport
network
available to applications
l Internet: TCP and UDP
An Analogy: Cousins sending letters
East Coast We s t C o a s t
Postal-service
Uncle Sam mail carrier Uncle Bill
Packet 2
Figure 3.16: Connectionless and connection-oriented
service represented as FSMs
3-2 TRANSPORT-LAYER PROTOCOLS
40
3.2.1 Simple Protocol
44
Example 3.3
Figure 3.19 shows an example of communication using this
protocol. It is very simple. The sender sends packets one
after another without even thinking about the receiver.
F ig ure 3.19: Flow diagram for Example 3.3
3.2.2 Stop-and-Wait Protocol
50
Note
51
Note
52
Note
53
Stop-and-Wait , lost frame
When a receiver
receives a damaged
frame, it discards it and
keeps its value of R.
After the timer at the
sender expires, another
copy of frame 1 is sent.
Stop-and-Wait, lost ACK frame
• If the sender
receives a damaged
ACK, it discards it.
• When the timer of
the sender expires,
the sender
retransmits frame 1.
• Receiver has
already received
frame 1 and
expecting to receive
frame 0 (R=0).
Therefore it discards
the second copy of
frame 1.
Stop-and-Wait, delayed ACK frame
• The ACK can be delayed
at the receiver or due to
some problem
• It is received after the
timer for frame 0 has
expired.
• Sender retransmitted a
copy of frame 0.
However, R =1 means
receiver expects to see
frame 1. Receiver
discards the duplicate
frame 0.
• Sender receives 2 ACKs,
it discards the second
ACK.
F i g u re 3 . 2 1 : F SM for the Stop-and-Wait protocol
Disadvantage of Stop-and-Wait
Solution
The bandwidth-delay product is still 20,000 bits. The system
can send up to 15 packets or 15,000 bits during a round trip.
This means the utilization is 15,000/20,000, or 75 percent.
Of course, if there are damaged packets, the utilization
percentage is much less because packets have to be resent.
3.2.3 Go-Back-N Protocol
66
Sequence Numbers
• Frames from a sender are numbered sequentially.
• We need to set a limit since we need to include
the sequence number of each frame in the header.
• If the header of the frame allows m bits for
sequence number, the sequence numbers range
from 0 to 2 m – 1. for m = 3, sequence numbers
are: 1, 2, 3, 4, 5, 6, 7.
• We can repeat the sequence number.
• Sequence numbers are:
0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, …
F i g u r e 3 . 2 4 : S e n d w i n d o w f o r G o -B a ck-N
Note
69
Note
70
Figure 3.25: Sliding the s e n d window
Sliding direction
Sender Sliding Window
• At the sending site, to
hold the outstanding
frames until they are
acknowledged, we use
the concept of a window.
• The size of the window is
at most 2m -1 where m is
the number of bits for
the sequence number.
• Size of the window can
be variable, e.g. TCP.
• The window slides to
include new unsent
frames when the correct
ACKs are received
Note
77
Acknowledgement
• Receiver sends positive ACK if a frame arrived safe and in
order.
• If the frames are damaged/out of order, receiver is silent and
discard all subsequent frames until it receives the one it is
expecting.
• The silence of the receiver causes the timer of the
unacknowledged frame to expire.
• Then the sender resends all frames, beginning with the one
with the expired timer.
• For example, suppose the sender has sent frame 6, but the
timer for frame 3 expires (i.e. frame 3 has not been
acknowledged), then the sender goes back and sends frames
3, 4, 5, 6 again. Thus it is called Go-Back-N.
• The receiver does not have to acknowledge each frame
received, it can send one cumulative ACK for several frames.
Go-Back-N , normal operation
82
F i g u r e 3 . 2 8 : S e n d w i n d o w s i z e f o r G o -B a ck-N
Go-Back-N , sender window size
• Size of the sender window must be less than 2 m.
Size of the receiver is always 1. If m = 2, window size
= 2 m –1 = 3. Fig compares a window size of 3 and 4.
Accepts
as the 1st
frame in
the next
cycle-an
error
F i g u r e 3 . 2 7 : F S M s f o r t h e G o -B a ck-N p r o t o c o l
Example 3.7
Figure 3.29 shows an example of Go-Back-N. This is an
example of a case where the forward channel is reliable, but
the reverse is not. No data packets are lost, but some ACKs
are delayed and one is lost. The example also shows how
cumulative acknowledgments can help if acknowledgments
are delayed or lost.
F ig ure 3.29: Flow diagram for Example 3.7
Example 3.8
Figure 3.30 shows what happens when a packet is lost.
Packets 0, 1, 2, and 3 are sent. However, packet 1 is lost.
The receiver receives packets 2 and 3, but they are discarded
because they are received out of order (packet 1 is
expected). When the receiver receives packets 2 and 3, it
sends ACK1 to show that it expects to receive packet 1.
However, these ACKs are not useful for the sender because
the ackNo is equal to Sf, not greater that Sf . So the sender
discards them. When the time-out occurs, the sender resends
packets 1, 2, and 3, which are acknowledged.
F ig ure 3.30: Flow diagram for Example 3.8
3.2.4 Selective-Repeat Protocol
95
Example 3.9
Assume a sender sends 6 packets: packets 0, 1, 2, 3, 4, and
5. The sender receives an ACK with ackNo = 3. What is the
interpretation if the system is using GBN or SR?
Solution
If the system is using GBN, it means that packets 0, 1, and 2
have been received uncorrupted and the receiver is
expecting packet 3. If the system is using SR, it means that
packet 3 has been received uncorrupted; the ACK does not
say anything about other packets.
F i g u r e 3 .3 4 : F S M s for S R protocol
Example 3.10
This example is similar to Example 3.8 (Figure 3.30) in
which packet 1 is lost. We show how Selective-Repeat
behaves in this case. Figure 3.35 shows the situation.
103
Note
104
3.2.5 Bidirectional Protocols