Hi Danijel,
Delayed Calls seem to be the best way to implement my idea for a notification system (on Windows) but I'm a little unsure of how to do it.
As an example, I have Client A, Client B and Client C connect to a Server and ask for any new data.
The frequency of new data for each individual client could range from a few seconds to several minutes or longer, and the time will vary for each client as new data is specific to them (the data is messages).
The Server is also a database server which the client programs connects to via a different port.
The basic flow is:
1. Each client calls an RTC function on the Server which is a delayed call.
2. At some point, the Server detects that new data is available for a specific client and posts the delayed call. The function won't return the actual data. It will just let the client know that there is new data to look for.
3. This bit is unrelated to RTC: the client then calls a stored procedure from the database server and gets its new data.
4. We then go back to step 1 and the loop continues.
So my questions are:
A. Is there an upper limit to how long the delay can be, and is there any downside to having long delay times?
I'm thinking I'll just have delays of a couple of minutes because it's not a problem if the client gets a response saying there is new data and there isn't (when the stored procedure is executed nothing is updated in the client software unless there really is new data). I want to get away from polling for data, hence the RTC delayed call solution. Customers want to be notified the instant there is new data, but doing this using polling with a check time of every 5 seconds floods the network. People are so impatient these days.
B. Is there some sort of array I should use to keep a list of delayed calls and to respond to the correct one when new data is available for a specific client?
Thanks,
Steve