It can run as a console app or as a windows service. What happens if the power goes out doesn't have any relevance to my original problem. UPS, would be my first guess.
-----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] Behalf Of John Bergman Sent: Wednesday, September 27, 2006 5:45 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Triggering events at precise moments of the day Is your app runing in the foreground, or as a windows service? > All those totals and counts are maintained in the memory What do you do if the power goes out? -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Eddie Lascu Sent: Wednesday, September 27, 2006 4:44 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Triggering events at precise moments of the day Ok, my bad, I didn't fully describe my application. It has to run 100% of the time as it does a lot of stuff. It is a router for Point-of-Sale transactions. It routes POS requests between multiple POS stations and the clearing operator that performs all the credit/debit card payments. This application of mine keeps track of all the transactions that are performed and at precise moments most close some batches and reconcile all the transactions with the clearing operator. All those totals and counts are maintained in the memory and I need something to trigger batch close operations at precise moments of the day. So, it doesn't do only the events I was talking about but lots of other stuff. -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] Behalf Of John Bergman Sent: Wednesday, September 27, 2006 5:35 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Triggering events at precise moments of the day It really depends on what you need to do. You could write a C# program that manipulates the other objects and structures anyway you want. You could schedule that using the at command (windows task scheduler) and even include a set of command line parameters for it to run and decide what to do internally. -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Eddie Lascu Sent: Wednesday, September 27, 2006 4:34 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Triggering events at precise moments of the day They don't have COM Interfaces (my app is a plain C# win service). Could you elaborate on your second solution? Thanks. -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] Behalf Of John Bergman Sent: Wednesday, September 27, 2006 5:30 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Triggering events at precise moments of the day You could use VBScript to interact with them if they have COM interfaces, or you can start an Executable with the scheduler itself. -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Eddie Lascu Sent: Wednesday, September 27, 2006 4:28 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Triggering events at precise moments of the day How would that interact with all the structures and objects that are created in my app? -----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] Behalf Of gregory young Sent: Wednesday, September 27, 2006 5:25 PM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: Re: [ADVANCED-DOTNET] Triggering events at precise moments of the day Well depending what you are doing I would prbably just use windows scheduler. On 9/27/06, Eddie Lascu <[EMAIL PROTECTED]> wrote: > Hello experts, > > I need to call a method in my console app/win service at precise > moments of > the day. When I say precise I mean +/- a few seconds. The number of > events triggered and the time of the day when they should be triggered > is variable. > If only one method call must be performed, then it should always be > approximately at the same time of the day, say midnight. If two events > are to be fired, they should be say 12 hours apart, noon and midnight, > and so on. The configuration part I can handle. I need some ideas on > how to trigger > the events. > I thought about having a dedicated thread where I would have lots of > sleep periods in an infinite loop. After each sleep period, I could > compare the current time with the time of the next event that must be > fired. The event would have to be fired in X seconds and I would enter > in a new sleep period > for X/2 seconds. Eventually, the difference between the current time > and the > time of the next event would become smaller that an acceptable delta, > at which moment I would fire the event and would enter in a new sleep period. > This way the events would always be fired at approximately the same > times of > the day, and I wouldn't have to worry about the moment when the > application/win service was started. > I am not particularly proud of this solution as it seems kind of > empiric, but I just couldn't think of anything else. > Can you gals and guys come up with a more elegant and reliable approach? > > TIA, > Eddie > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > > View archives and manage your subscription(s) at http://discuss.develop.com > -- If knowledge can create problems, it is not through ignorance that we can solve them. Isaac Asimov =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor. http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor. http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor. http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com