473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Windows Service and time check question

I want to make a schedule of events to occur in a windows service (kinda
like a scheduler) so the user can specify through an external interface to
do a task at a certain time... like this

8pm - import data
2am - process data

but how exactly would you check for those times in order to start the
processing? is there another way besides using a time to check every second
or is that the only way around it? thanks!
Nov 21 '05 #1
3 1200
Hi Brian,

I think we do need to check the data to know if a program needs to be
started. We know that the OS is running based on one real-time clock which
help to do the thread schedule. In the low level the OS utilize the clock
IRQ to do the job. On the high level, i.e. the our program running on the
OS, OS provides the similar machanism, i.e. the timer function, in .net
framework the Timer is the wrap class for the OS provided timer.

I think a normal and recommend approach is to check the scheduled programs
trigger time periodically e.g. every 1 minutes. Once we find that there
will be one program will be running in one minutes(e.g. after 30 seconds,
the program need to be started), then we can start another timer and set
its Interval to be 30000(30 seconds) and handle its Elapsed event, thus, 30
seconds later, the event handler will be called to start the program.

Here is a C# program, you may try to take a look.
http://www.thecodeproject.com/csharp/scheduler.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #2
thats what i thought, thanks

""Peter Huang"" <v-******@online.microsoft.com> wrote in message
news:mb*************@cpmsftngxa06.phx.gbl...
Hi Brian,

I think we do need to check the data to know if a program needs to be
started. We know that the OS is running based on one real-time clock which
help to do the thread schedule. In the low level the OS utilize the clock
IRQ to do the job. On the high level, i.e. the our program running on the
OS, OS provides the similar machanism, i.e. the timer function, in .net
framework the Timer is the wrap class for the OS provided timer.

I think a normal and recommend approach is to check the scheduled programs
trigger time periodically e.g. every 1 minutes. Once we find that there
will be one program will be running in one minutes(e.g. after 30 seconds,
the program need to be started), then we can start another timer and set
its Interval to be 30000(30 seconds) and handle its Elapsed event, thus,
30
seconds later, the event handler will be called to start the program.

Here is a C# program, you may try to take a look.
http://www.thecodeproject.com/csharp/scheduler.asp

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.

Nov 21 '05 #3
Hi Brian,

I am glad that my suggestion will help you.

Cheers!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Bill Sonia | last post by:
I've written a Windows Service to send e-mails on events like OnStart, OnStop, OnShutDown using System.Web.Mail. It works for everything but OnShutdown. My guess is that for OnShutDown, once my...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
5
by: Steve Long | last post by:
Hello, I hope this question isn't too fundamental. I have a feeling it is. I'm trying to start a winform app from a windows service written in C#. I created a class and used it from a windowsforms...
4
by: Kris | last post by:
I have a Windows Service in C# talking to a serial port and using Remoting. It also uses several COM objects. On customer's computer the service will occassionally hang somewhere - the service...
1
by: Al | last post by:
I have a single project that contains 8 different windows services. There is a seperate installation project in the solution for the Windows Services. Both projects build fine with no errors. The...
3
by: Yves Royer | last post by:
Hi all, I have a little question about Windows Services. For my app i need 3 different Windows Services, each with its own functionality. I'm trying to make a test service to see what happens...
2
by: Genojoe | last post by:
I have a Windows Service (VB.NET) that runs 24/7. It contacts a Web Service (VB.NET on IIS). As long as we send requests to the Web Service at least once every 15 minutes, everything works fine....
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
5
by: Tom | last post by:
Using multiple System.Timers.Timer objects in a Windows Service for performing multi-thread activities in a periodic fashion. Timers are AutoReset=false, to only have a single timer execution...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.