I have a program which is constantly reading from a stream and what I'm
wanting to do is, if the stream hasn't sent anything after a certain amount
of time then do something. I've tried doing this like this...
while(!done)
{
idleTimer.Start();
response = streamReader.ReadLine();
idleTimer.Stop();
....
The interval on the Timer is set to 10000 (10 seconds) but I've hung
response = streamReader.ReadLine() for five minutes and it still doesn't run
the Timer's Tick event. The interesting thing though, is if I do this...
idleTimer.Start();
MessageBox.Show("Testing...");
response = streamReader.ReadLine();
idleTimer.Stop();
....and then don't press the button on the message box, after 10 seconds the
Tick event is fired. So why not after 10 seconds of waiting for a response
from the stream? I've even tried sticking the timer stuff in it's own thread
but I get the same problem.
Please help,
Darrell