Content
- Go-Back-N
- Flow
- Selective Repeat
- Flow
- Window Size
Go-Back-N
Sender
- Sends up to N packets
- Sets timer of oldest un-ACKed packet
- Retransmit all un-ACKed packets on timeout
Receiver
- Discards out-of-order packets
- Resend
ACK
of last received packets to inform sender
Flow
- Sender
rdt_send()
- If window not exhausted
- Transmit data
- Increase
seq #
- Start timer if not previously done
- If exhausted (
nextseqnum == base+N
)- Block & wait for window to open
- If window not exhausted
rdt_rcv(ACK(n))
: all packets beforeseq # = n
have arrived (cumulative ACK)- Advance window until
base + seq #
- Advance window until
timeout()
- Retransmit all packets after oldest unACKed
seq #
- Retransmit all packets after oldest unACKed
- Receiver
rdt_rcv(data(n))
: receive window of size 1- If error || not
expectedseqnum
- Discard
Re-ACK
the highest-orderseq #
- Else
- Increment
expectedseqnum
- Advance window by 1
- Send
ACK
- Increment
- If error || not
Selective Repeat
- Sender
- Sends up to N packets
- Sets timer of every un-ACKed packet
- Retransmit that un-ACKed packets on timeout
- Receiver
- Buffers out-of-order packets
- Send
ACK
for each received packet
Flow
- Sender
rdt_send()
rdt_rcv(ACK(n))
- If in current window
[base,nextseqnum-1]
- Mark packet
n
as received - If
n == base
, advance window until next unACKed packet
- Mark packet
- If in current window
timeout(n)
- Resend packet
n
- Restart timer
- Resend packet
- Receiver
rdt_rcv(data(n))
- If in current window
[base,base+N-1]
- Send
ACK(n)
- If out-of-order
- Buffer
- If in-order
- Deliver to upper layer
- Advance window until next not-yet-received packet
- Send
- If in previous window
[base-N,base-1]
- Resend
ACK(n)
- Resend
- Else
- Ignore
- If in current window
Window Size
- Go-Back-N
Window size must be less than 2^k
.
- Selective Repeat
Window size must be at most 2^(k-1)
(so that can differentiate between current & previous windows).