0

I am building a tutoring application that multiple students can sign into the same session with a tutor.

My question is, for example, if I sent out a command to draw a line, do I need to wait to see that all connected students propagated the command. Now, it relies that requests will be processed in order.

But consider this. If I draw one point, drag and draw another point, it will draw a line. But if I don't wait to see if each step propagated to all students' screens successfully, a student might receive an instruction of drag, draw, draw.

However, waiting for each connected user's input seems to be a very slow approach. Is there any way I can solve this efficiently? Or is this a problem at all?

2
  • Basically you're asking how to avoid race conditions in a networking system?
    – Joe Z.
    Commented Jan 5, 2013 at 16:35
  • @JoeZeng, if the concept is named the same way for networks, then yes.
    – jn1kk
    Commented Jan 5, 2013 at 16:39

1 Answer 1

2

One way I could think of is to encode a unique numerical order for each draw instruction, so if they were sent out of order, the program picking it up would know that it was out of order and could correct the drawing accordingly.

I'm not sure this way is the best way, though, as it means that if the packets are wildly out of order, the drawing will fluctuate a lot.

2
  • It seems the ids for transactions should come from the server as well so there is a centralized order for commands/instructions.
    – jn1kk
    Commented Jan 5, 2013 at 16:48
  • The numerical order would be generated by the server in the order that the draw commands are executed, and then sent out to the clients. You are correct.
    – Joe Z.
    Commented Jan 5, 2013 at 16:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.