How to Make a .NET Timer Always Fire at the Right Time

  • Thread starter Thread starter Charles
  • Start date Start date
I have worked with setups where the server side closed the connection
after
just 20 seconds of inactivity, because it was more important for the
connection to be "known good" even at short intervals than it was to be
mindful of the bandwidth wasted this way.

I'm not saying this is a good way of doing things (using short
transmission timeouts is probably a better idea), but I don't think it's
unusual either.

Ok thanks I was wondering (as you saw I'm not that familiar with TCP but
thought it was connection oriented and both end had to agree to close the
connection). Charles, sorry for having hijacked this part of your thread ;-)
 
Windows is non-deterministic.

As other replies indicate, you simply cannot assure yourself that this
happens -- unless you design you system such that the user (or your own
code) cannot cause trouble. The most reliable way to do this is to dedicate
a processor, another computer, to the time-critical task. It you don't
allow the user, or your own code, to use that environment for anything other
than your time critical process, you should be OK. You'd then add a
non-time critical communications method to that process that communicates
results to your "loaded" machine, where you can then allow the user -- or
your own code -- do things that otherwise mung up the system.

Dick

--
Richard Grier, Consultant, Hard & Software 12962 West Louisiana Avenue
Lakewood, CO 80228 303-986-2179 (voice) Homepage: www.hardandsoftware.net
Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004, Revised July
2006.
 
Hi Dick

I understand what you say. But surely there's non-deterministic, and there's
non-deterministic. I'm not talking about milliseconds. This is where a
10-second timer goes off after 30 seconds. I don't call that a timer. This
machine isn't doing anything it isn't designed to do, and it's well within
its memory and CPU capacity.

The symptom, to me, is that of using the wrong kind of timer, which I'm
happy to discover. I find it hard to believe that there isn't a way to get
Windows to keep time to an accuracy of 200% over 10 seconds.

Regards

Charles
 
I don't know if is to late, to give you one idea,

I did have the same problem, i did have to develop one small app, to keep a
VPN tunnel up and running, until change one of the VPN pix,

What i did do to kip the connection up and running was a ICMP app, using
Background worker this basically ping a host from the other lan and this way
my pix that was broke dint let the tunnel get down.
And the BackGroundWorker don't let my CPU get stress up.

Cheers,

Mike
 
Hi Mike

Thanks for the idea. I think I have it sorted now, but I will keep this in
mind.

Cheers

Charles
 
Back
Top