selective repeat

Hello!
I am implementing selective repeat protocol in C. How can I have multiple timers. Everytime i send a packet i want to start a timer. timer runs till acknowledgement is received.If sending window is of size 7, i need 7 timers running simultaneously.How can i do that?
This is a very complex problem that depends on how your packet code
is used. I'm assuming that you want your program to be busy doing
other things while waiting for acknowledgments, which means you need
an asynchronous solution.

Without going into the details of an asynchronous solution, to answer
your question, you don't necessarily need multiple timers. Since you
obviously need to store the outgoing messages in a retry queue, you
can store a "send" timestamp with each.

Find the message on the retry queue with the oldest timestamp
(probably the first one), compute the time left, and set one timer
for this duration.

Each time you receive an ack, you'll need to repeat the above: again,
find the message on the retry queue with the oldest timestamp, etc.

This way you only need 1 timer.

Topic archived. No new replies allowed.