I have a console application that checks a mail server using the pop protocol, processes any emails it finds, and terminates.
I plan to schedule it using the Task Scheduler. The problem is that I can only schedule it to run every minute (or longer)but nothing less.
Speed is a critical factor for this application, and so I'm hoping I can schedule it so its always checking for emails. I'm wondering what the best approach for this would be.
Is an infinite loop the only way?
I thought of making it a windows service, but wouldn't that also need an infinite loop?
Thanks
Two possibilities, but each depend on what your requirements are.
First off, if you want continuous monitoring, why does the application need to terminate? Could your application pause, or loop and drive the updates itself? Why would this inifinite loop be a bad design choice, if that's what you want?
Second possibility, can this client be driven from a Linux or Unix host of some sort, rather than from Windows? *nix operating systems have the "cron" functionality, which provides recurring tasks down to the single second resolution.
If Unix is out, and you don't want to write your own infinite loop, you will want to look for some sort of scheduler program other than Task Scheduler, which provides you more fine grain control on the timing.