Scenario:
- 4 users launch separate instances of the same client program (Winforms) that is connected to a database based To-Do list.
- The first user selects the 3rd To-Do list item.
How do I update/refresh the other 3 users screens to reflect that item #3 is no longer available?
My thought was a table that contains the last update date-time stamp. Then a timer would check every few seconds to see if there have been any changes.
UPDATE1:
Thanks to all – there are definitely a number of valid answers.
I went with simpler version of the scenario that Icemanind recommended.
Yes. The best way to do this is to implement a “push” type system. Here is how it would work. Whenever someone clicks something on the client end, the client would send a message to the server. The server would need to receive this signal and then the server would send out a refresh message to all clients connected to the server.
I don’t know your client or server is coded, but you’ll want to create a thread on the server that “listens” for incoming messages from clients and once it receives a message, puts it into a queue, the returns to listening for more messages. A second thread on the server needs to process the messages in the queue.
On the client side, you’ll also want a second thread that listens for incoming messages from the server. Once a message is received, it can process the message and take whatever action is necessary.
A pretty decent tutorial on client/server and socket programming can be found here: http://www.codeproject.com/KB/IP/serversocket.aspx
Of course, it is a guide. You will need to modify it as you see fit.
Hope this makes sense and good luck!