1

I want to implement something basic:

  • N users on N different computers to see a canvas with N dots.

  • Each user controls a single dot with his arrow keys.

  • Each user can see all other users' (and his own) dots moving around.

  • Once a user connects, a corresponding dot appears.

  • Once a user disconnects, the corresponding dot disappears.

Can you please suggest software to achieve this?

I would like to implement myself as much as possible, following an existing example. Language / technology is not a constraint.

1

If you are writing from scratch:

  • Lets start that you have a program that can plot dots.
  • Each computer whenever his user moves his dot sends a single packet out on the broadcast address on an agreed on port. The packet contains the user ID and the new coordinates of the user's dot.
  • all the other computers when they here that broadcast packet update the corresponding dot.

  • If the computers aren't on the same subnet, you will either have to use multicast, or you will set up a server. Every computer in this case sends a packet to the server. The server periodically sends a packet with the new locations to all the dots. I suspect that 4-5 times per second would be sufficient.As long as N is reasonably small -- say under 100 -- all the new coordinates should fit into a single network packet. (about 1400 bytes payload) If N gets larger, you may want to look at various compression schemes.

0

I don't have a tutorial describing exactly that, but you could do it with WebSockets and your favorite web technologies.

While with a pure HTTP connection each action of the server requires a previous request from the client, with the WebSocket protocol it is sufficient for the client to open the connection. The server can then actively use this open connection and can deliver new information to the client without waiting for a new connection from the client.

Maybe this will help you to find tutorials.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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