What can be done?
Solution: rather than operate in stop-and-wait mode, the sender is allowed to send multiple packets without waiting for ACK. This method is called pipelining.
Consequences:
| Already ACK'd | |
| Sent, not yet ACK'd | |
| Usable, not yet sent | |
| Not usable |
Go-back-N sender has to respond to the following events:
| Initial conditions:
|
|
| Event | Action |
|---|---|
| invocation from above |
if( nextseqnum < base + N ){
make packet[nextseqnum] (data, checksum, seq#=nextseqnum)
send packet[nextseqnum]
if( base == nextseqnum ){
start timer
}
nextseqnum++
}
else{
/* buffer is filled out with unACK'd packets */
refuse the data
}
|
| timeout |
/* re-send all packets starting with the first unACK'd */ start timer send packet[base] send packet[base+1] ... send packet[nextseqnum-1] |
| not corrupted packet received |
base = ACK_number + 1;
if( base == nextseqnum ){
/* we have no ACK's to wait for */
stop timer
}
else{
start timer
}
|
| corrupted packet received | nothing to do just keep on waiting |
| Initial conditions:
|
|
| Event | Action |
|---|---|
| received packet |
extract data from the packet pass data to the upper level make ack packet (ACK, checksum, seq#=expectedseqnum) send ack packet expectedseqnum++ |
| received a corrupted packet
or packet seq# != expectedseqnum |
send ack packet |
See applet for Kurose-Ross book that illustrates how Go-back-N works.
|
Keys:
|
||||||||||||||||||||||||||||||||||||||
|
Keys:
|
||||||||||||||||||||||||||||||||||||||
Receiver Algorithm: