timer in a service???

  • Thread starter Thread starter DaveF
  • Start date Start date
D

DaveF

The service is an FTP that every 5 minutes calls an ftp server and downloads
images. The problem is if the 5 minute timer is up before I am done
downloading the files, it will cut the download off. I have to do it every 5
minutes. It is rare this happens, but it will sometimes. Is there a way
around this? I use:

timer = new System.Timers.Timer();
timer.Interval = 300000;
timer.Elapsed += new ElapsedEventHandler( ServiceTimer_Tick );
 
Hi dave,


Two possible solutions:

1- Disable the timer when you start downloading, and enable it after you
finish.
2- Use a flag variable, check the status of the flag starting the method and
process the event if the variable is not set.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top