Click here to Skip to main content
15,898,035 members
Home / Discussions / C#
   

C#

 
GeneralRe: what is the optimal method for handling time-triggered processing Pin
TimWallace9-Mar-10 7:51
TimWallace9-Mar-10 7:51 
GeneralRe: what is the optimal method for handling time-triggered processing Pin
Not Active9-Mar-10 8:01
mentorNot Active9-Mar-10 8:01 
GeneralRe: what is the optimal method for handling time-triggered processing Pin
TimWallace9-Mar-10 9:17
TimWallace9-Mar-10 9:17 
GeneralRe: what is the optimal method for handling time-triggered processing Pin
Matthew Klein9-Mar-10 11:02
Matthew Klein9-Mar-10 11:02 
AnswerRe: what is the optimal method for handling time-triggered processing Pin
Ian Shlasko9-Mar-10 8:30
Ian Shlasko9-Mar-10 8:30 
AnswerRe: what is the optimal method for handling time-triggered processing Pin
Ennis Ray Lynch, Jr.9-Mar-10 9:46
Ennis Ray Lynch, Jr.9-Mar-10 9:46 
AnswerRe: what is the optimal method for handling time-triggered processing Pin
Luc Pattyn9-Mar-10 11:09
sitebuilderLuc Pattyn9-Mar-10 11:09 
AnswerRe: what is the optimal method for handling time-triggered processing Pin
AspDotNetDev9-Mar-10 12:18
protectorAspDotNetDev9-Mar-10 12:18 
Sounds like you have two questions here.
  1. How do you process the data on the server at the correct time?
  2. How do you notify the client of the finished processing?


For #1, I'd say you can do as another person said and store the times in a database table with an index on the date to process. That way, the lookup is very quick. You could use SQL Server or SQL Server CE for this simple task. If you want it to be in-memory, you could store it in a binary tree or some other sorted structure. If the list is not modified very often (sounds like it isn't), the recommendation somebody else had of using a linked list would be a good one. You just get the next time that will be processed and start a timer that will go off at that time (or you have a background thread and use sleep commands to do the same thing). You then either maintain a pointer (linked list) to the next item to be processed or use the date (binary tree, indexed database table) to find the next item to schedule.

For #2, that depends on if the server can send notifications to the clients. If not, then I'm sure the clients know when they are expecting the data to be processed (if not, they can ask the server when they're supposed to be processed). You can have the clients request, from the server, the data at that time of the day... you can do this using a timer. If the data hasn't been generated yet, you can either have the server block until it is generated, then return the data back to the client. Or, you can have the server send a response saying "sorry, no data yet". The client can wait a second, then send the request again. Then 2 seconds, then 4, then 8, then 16, and so on (doubles each time) until it finally gets a valid response.

One thing you'll need to consider is where you will store the data until the client requests it. You could store that in a dictionary in memory, or you could serialize it and store it to a database until the client requests it.
GeneralRe: what is the optimal method for handling time-triggered processing Pin
TimWallace9-Mar-10 13:39
TimWallace9-Mar-10 13:39 
AnswerRe: what is the optimal method for handling time-triggered processing Pin
PIEBALDconsult9-Mar-10 13:39
mvePIEBALDconsult9-Mar-10 13:39 
QuestionSave an object to my exe? Pin
Matthew Klein9-Mar-10 5:38
Matthew Klein9-Mar-10 5:38 
AnswerRe: Save an object to my exe? Pin
Not Active9-Mar-10 6:47
mentorNot Active9-Mar-10 6:47 
AnswerRe: Save an object to my exe? Pin
Dan Mos9-Mar-10 6:47
Dan Mos9-Mar-10 6:47 
AnswerRe: Save an object to my exe? Pin
Luc Pattyn9-Mar-10 7:09
sitebuilderLuc Pattyn9-Mar-10 7:09 
GeneralRe: Save an object to my exe? Pin
Som Shekhar9-Mar-10 7:26
Som Shekhar9-Mar-10 7:26 
GeneralRe: Save an object to my exe? Pin
Luc Pattyn9-Mar-10 9:42
sitebuilderLuc Pattyn9-Mar-10 9:42 
AnswerRe: Save an object to my exe? Pin
Dave Kreskowiak9-Mar-10 7:32
mveDave Kreskowiak9-Mar-10 7:32 
AnswerRe: Save an object to my exe? Pin
Matthew Klein9-Mar-10 7:44
Matthew Klein9-Mar-10 7:44 
AnswerRe: Save an object to my exe? Pin
#realJSOP9-Mar-10 8:40
professional#realJSOP9-Mar-10 8:40 
AnswerRe: Save an object to my exe? Pin
AspDotNetDev9-Mar-10 12:44
protectorAspDotNetDev9-Mar-10 12:44 
AnswerRe: Save an object to my exe? Pin
AspDotNetDev9-Mar-10 12:57
protectorAspDotNetDev9-Mar-10 12:57 
GeneralRe: Save an object to my exe? Pin
Matthew Klein9-Mar-10 13:23
Matthew Klein9-Mar-10 13:23 
QuestionComparing things with null - but not for equality Pin
harold aptroot9-Mar-10 5:05
harold aptroot9-Mar-10 5:05 
AnswerRe: Comparing things with null - but not for equality Pin
Dan Mos9-Mar-10 5:33
Dan Mos9-Mar-10 5:33 
QuestionCode is Rounding Down instead of Rounding Up Pin
suprsnipes9-Mar-10 4:15
suprsnipes9-Mar-10 4:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.