Title: CS 352 Internet Technology Transport Protocols
1CS 352Internet TechnologyTransport Protocols
- Dept. of Computer Science
- Rutgers University
2Reliable Data Transfer
- Problem 1 Flow Control
- Receiver can only handle a fixed amount of data
- Problem 2 Reliability
- Want an abstraction of a reliable link even
though packets can be lost - Solution to both problems is to keep track of the
packets - Not as simple as one would expect
3Data Transfer
- Both problems can be solved using a family of
related reliable data transfer algorithms - Alternating Bit Protocol (ABP)
- Go-back-N
- Selective Repeat
- Algorithms range in complexity and performance
4Flow Control
- What happens if the sender tries to transmit
faster than the receiver can accept? - Data will be lost unless flow control is
implemented
5Controlling the Flow of Data
Busy Client
Slow Server
6Some Flow Control Algorithms
- Flow control for the ideal network
- Stop and Wait for noiseless channels
- Stop and Wait for noisy channels
- Sliding window protocols
- Sliding window with error control
- Go Back N
- Selective Repeat
7 Flow control in the ideal network
- Assumptions
- Error free transmission link,
- Infinite buffer at the receiver
No acknowledgement of frames necessary Since the
data link is error-free and the receiver can
buffer as many frames as it likes, no frame will
ever be lost
8Flow control in the ideal network (contd)
Busy Client
Slow Server
Infinite Box
9Stop and Wait with Noiseless Channels
- Assumptions
- Error free transmission link,
- Finite buffer at the receiver
- Problem of Buffer overflow at the receiver
- Buffer overflow may happen at the receiver when
the sender sends frames at a rate faster than the
receiver can accept
10Stop and Wait with Noiseless Channels (contd)
Busy Client
Slow Server
Finite Box (once full, Letter is lost)
Bit Bucket
11Stop and Wait with Noiseless Channels (contd)
- Solution Stop-and-Wait
- The receiver sends an acknowledgement frame
telling the sender to transmit the next data
frame. - The sender waits for the ACK, and if the ACK
comes, it transmits the next data frame.
12Stop and Wait with Noiseless Channels (contd)
Data
Data
13Stop and Wait (contd)
- Note that we assume an error-free transmission
link and therefore ACK frames will not be lost - In this flow control protocol, there are two
types of frames data frames and ACK frames. The
ACK frames dont contain any particular
information, since only the arrival of the ACK
frame at the sender is important.
14 Stop and Wait with Error
- Assumptions
- Transmission link may cause errors in frames,
- Finite buffer at the receiver
Data and ACK frames may be lost
15Problems introduced by Errors
- Error model
- Packet can be dropped in the network
- Packets can be delayed for a bounded amount of
time - maximum packet lifetime
- Problem 1 Loss of a data or ACK frame
- Since the transmission path through the network
is not error-free, a data or ACK frame may be
lost, causing the sender to wait indefinitely for
an ACK
16Loss of an ACK frame
Data
?
17Problems introduced by errors
- Can we solve problem 1 by introducing a timeout
period for the sender? Yes, but that introduces
... - Problem 2 Duplicated frames
- If the ACK frame for a certain data frame is
lost, the sender will retransmit the same frame
after a time-out period, and the receiver will
then have two copies of the same frame - Note Setting the timeout longer than the maximum
packet lifetime does not help
18Duplicated Data Frames
Sell 10 Shares!
Wheres the ACK?
Sell 10 Shares!
Sold 20!
19Alternating Bit Protocol (ABP)
- Solution
- The sender uses a timer to retransmit data frames
when an ACK has not arrived - The sender includes a sequence number in each
frame to distinguish one frame from another.
This way, the receiver knows when it has received
duplicate frames. - The Receiver uses the sequence number in the
acknowledgement - The sender alternates the sequence number between
0 and 1 on each ACKed frame
20Alternating Bit Protocol Normal
Data
Data
21Alternating Bit ProtocolPacket Loss
Data
Wheres the ACK?
Data
Duplicate
22ABP Robustness
- ABP is robust to
- Packet Loss
- ACK loss
- Not Robust to
- Active attacks (spoofing)
- Arbitrary Delay
- Must set timeout gt Maximum packet lifetime in
the network
23Is ABP the best we can do?
- Alternating Bit protocol is an effective
reliability protocol, but - Its not very efficient.
- 1. Only one data frame can be in transit at a
time - 2. When waiting for an acknowledgement, the
sender cannot transmit any frames - What happens to packet switching in this case?
- Goal Keep multiple packets in the network to
improve performance - Solution Sliding window protocols
- Recall packet vs. message switching analysis
24Pipelining
packet 5
packet 4
packet 6
Ack 0
Ack 2
Ack 1
25Pipelining
data stream
99
51
50
A
B
49
1
0
ACK stream
- By allowing several frames onto the link before
receiving an acknowledgement, pipelining keeps
the communications path from being idle - Sliding windows generalize ABPs single bit into
an N-bit sequence number - Must keep track of multiple outstanding packets
26Pipelining (cont)
Data
Host A
Switch 1
Switch 2
Host B
Packet 1
Packet 2
Packet 3
Time
Packet 4
Ack1
Ack1
Ack1
Ack2
Ack2
Ack2
Ack3
Ack3
Ack3
Ack4
Ack4
Acknowledgements
Ack4
27Sliding Window ProtocolsDefinitions
- Sequence Number Each frame is assigned a
sequence number that is incremented as each frame
is transmitted - Sender Window Keeps track of sequence numbers
for frames that have been sent but not yet
acknowledged - Receiver Base Last sequence number receiver has
correctly received - Receiver Window Keeps track of sequence numbers
for frames the receiver is allowed to accept - Maximum Sender Window size The maximum number
of frames the sender may transmit without
receiving any acknowledgements - Maximum Receiver Window size The maximum number
of frames the receiver may receive before
returning an acknowledgement to the sender
28Sliding Window Definition
Key
Already Acked
Usable, not yet sent
Sent, not Yet Acked
Not usable
rcv_next
Already Acked
Packets
Not usable
next
29Simple Sliding Window with Window Size of 1
- A sliding window with a maximum window size of 1
frame - Modulo-arithmetic results in a circular view
this 1-packet window using a 3-bit sequence
number - E.g. 314 440 (44)8
30Sliding Window example
Sender window
Receiver window
(a)
(b)
(c)
(d)
(a) Initial state, no frames transmitted (b)
Sender transmits frame 0 (c) Receiver receives
frame 0 and ACKs (d) Sender receives ACK
31Simple Sliding Window withWindow size 1 (contd)
- This protocol behaves identically to ABP
- In General
- With window size W
- How do the sender an receiver manipulate base,
next and max in response to packet arrival and
timeout events? - What packets are sent in response to these
events?
32Sliding Window ProtocolsGeneral Remarks
- The sending and receiving windows do not
necessarily have the same maximum size - Any frame whose sequence number falls outside the
receiver window is discarded at the receiver - The sender windows size grows and shrinks as
frames are transmitted and acknowledged - Unlike the sender window, the receiver window
always remains at its maximum size
33Sliding Window ProtocolsPiggybacking
Acknowledgements
- Since we have full duplex transmission, we can
piggyback an ACK onto the header of an outgoing
data frame to make better use of the channel
When a data frame arrives at a router, instead of
immediately sending a separate ACK frame, the
router waits until it is passed the next data
frame to send. The acknowledgement is attached
to the outgoing data frame.
34Sliding Window with Maximum Sender Window Size WS
- With a maximum window size of 1, the sender waits
for an ACK before sending another frame - With a maximum window size of WS, the sender can
transmit up to WS frames before being blocked - This allows the sender to transmit several frames
before waiting for an acknowledgement
35Sender-Side Window with WS2
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(a) Initial window state (b) Send frame 0 (c)
Send frame 1 (d) ACK for frame 0 arrives
(e) Send frame 2 (f ) ACK for frame 1 arrives (g)
ACK for frame 2 arrives, send frame 3 (h) ACK for
frame 3 arrives
36Sliding Window with Maximum Receiver Window Size
WR
- With a maximum window size of 1, the receiver
must receive and process every frame in sequence - With a maximum window size of WR, the receiver
can receive and process up to WR frames before
acknowledging them - This is useful when frames are lost the receiver
can still accept and buffer frames after the
missing frame
37Receiver-Side Window with WR2
(a)
(b)
(c)
(d)
(e)
(f)
(g)
(h)
(a) Initial window state (b) Nothing happens (c)
Frame 0 arrives, ACK frame 0 (d) Nothing happens
(e) Frame 1 arrives, ACK frame 1 (f) Frame 2
arrives, ACK frame 2 (g) Nothing happens (h)
Frame 3 arrives, ACK frame 3
38What about Errors?
- What if a data or acknowledgement frame is lost
when using a sliding window protocol? - Two Solutions
- Go Back N
- Selective Repeat
39Sliding Window with Go Back N
- When the receiver notices a missing or erroneous
frame, it simply discards all frames with greater
sequence numbers and sends no ACK - The sender will eventually time out and
retransmit all the frames in its sending window
40Go Back N
Timeout interval
Sender
0
1
2
3
4
2
3
4
5
6
Maximum window size 8
ACK 6
ACK 0
ACK 1
ACK 2
ACK 3
ACK 4
ACK 5
Receiver
0
1
E
D
D
2
3
4
5
6
Maximum window size 8
Discarded by receiver
Frame with error
Time
41Go Back N (contd)
- Go Back N can recover from erroneous or missing
frames - But
- It is wasteful. If there are errors, the sender
will spend time retransmitting frames the
receiver has already seen
42Sliding Window with Selective Repeat
- The sender retransmits only the frame with errors
- The receiver stores all the correct frames that
arrive following the bad one. (Note that the
receiver requires a frame buffer for each
sequence number in its receiver window.) - When the receiver notices a skipped sequence
number, it keeps acknowledging the last good
sequence number - When the sender times out waiting for an
acknowledgement, it just retransmits the one
unacknowledged frame, not all its successors.
43Selective Repeat
Key
base
next
Already Acked
Usable, not yet sent
max
Packets
Sent, not Yet Acked
Not usable
Window size N
rcv_base
max
Acked, buffered
Packets
Acceptable
next
Not usable
44Selective Repeat
Timeout interval
Sender
0
1
2
3
4
2
5
6
Maximum window size 8
ACK 6
ACK 0
ACK 1
ACK 4
ACK 5
ACK 1
ACK 1
Receiver
0
1
E
2
5
6
3
4
Maximum window size 8
Buffered by receiver
Frame with error
Time