Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. N = window size
  2. Sn = sequence number
  3. Sb = sequence base
  4. Sm = sequence max
  5. ack = ack number
  6. nack = first non acknowledged
  7. Receiver:
  8. Do the following forever:
  9. Randomly accept or reject packet
  10.  
  11. If the packet received and the packet is error free
  12. Accept packet
  13. Send a positive ack for packet
  14. Else
  15. Refuse packet
  16. Send a negative ack for packet
  17.  
  18. Sender:
  19. Sb = 0
  20. Sm = N − 1
  21. ack = 0
  22. Repeat the following steps forever:
  23. Send packet with ack
  24. If positively ack is recieved:
  25. ack++
  26. Transmit a packet where Sb <= ack <= Sm.
  27. packets are transmitted in order
  28. Else
  29. Enqueue the nack into the queue
  30. //check if last packet in the window is sent
  31. if(ack==Sm)
  32. if(queue is not empty)
  33. // start from the first nack packet
  34. nack = queue.front();
  35. empty the queue
  36. ack = nack
  37.  
  38. Sm = Sm + (ack − Sb)
  39. Sb = ack
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement