Working with windows service in c#

  • Thread starter Thread starter R A
  • Start date Start date
R

R A

Hi

I have created a windows service. I need the service to monitor some file
status for any changes in the file size. How can I have the service execute
the monitor function lets say every 10 seconds? do I need to create a
seperate thread for that? I can't use the service events such as OnStart and
others because they are events and I want to constantly monitor the file
size.

Thnaks,
Ron
 
You can use a FileSystemWatcher for this.
This will notify u when your file has changed.

Greetz,
-- Rob.
 
Well the service needs to monitor other things also. Is there a way to
constantly process information in the service beside using its events.


Ron
 
Ron,

Basically, what you would do is have a timer that you spawn in the
OnStart method. Once you have that, you can check the file every time the
event fires.

I am curious though, why not instantate a FileSystemMonitor instance and
use that?

Hope this helps.
 
Back
Top