Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = window size
- Sn = sequence number
- Sb = sequence base
- Sm = sequence max
- ack = ack number
- nack = first non acknowledged
- Receiver:
- Do the following forever:
- Randomly accept or reject packet
- If the packet received and the packet is error free
- Accept packet
- Send a positive ack for packet
- Else
- Refuse packet
- Send a negative ack for packet
- Sender:
- Sb = 0
- Sm = N − 1
- ack = 0
- Repeat the following steps forever:
- Send packet with ack
- If positively ack is recieved:
- ack++
- Transmit a packet where Sb <= ack <= Sm.
- packets are transmitted in order
- Else
- Enqueue the nack into the queue
- //check if last packet in the window is sent
- if(ack==Sm)
- if(queue is not empty)
- // start from the first nack packet
- nack = queue.front();
- empty the queue
- ack = nack
- Sm = Sm + (ack − Sb)
- Sb = ack
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement