views:

38

answers:

1

I'm writing a WinForms app for a place I volunteer at. I'm stuck at one part though. How can I have multiple users running the app, an alarm go off at whatever time but have any given user shut off the alarm? So let's say 11:30 on Tuesday rolls around, an alarm goes off on 4 PC's and one of the users can click a button and the alarm goes off on all of them. How can that be accomplished? Sorry but I do not have any code to show that I have attempted it. That is because I'm not sure where to begin.

+4  A: 

You will probably want to have a client-server implementation.

You'll implement a server, with all your central info (alarm, etc...)

When the alarm is activated, it will send a message (packet) to all connected clients that the alarm is active. This starts the alarms on all computers (you can have many, not a fixed number).

When somebody disables the alarm, that person's client sends an alarm-termination message to the server. The server then terminates the alarm and does any additional code related to the operation. From that point it sends an "alarm canceled" message back to all clients which shuts off the audio representation.


The other solution would be client-client, but I would highly recommend client-server as clients only would have to know about the server, and the act of connecting to the server would make the server aware of all clients to manage them.

Aren
"client-client" is known as peer-to-peer.
Charles
I know. I used `client-client` for clarity sake. A lot of people have a different understanding of "peer-peer" (i.e. for some its synonymous with file sharing).
Aren