C# System.Threading.Timer and its state object
- by Captain NedD
I am writing a C# program that uses System.Threading.Timer to timeout on a UDP socket ReceiveAsync call.
My program polls a remote device, sending a UDP packet and expecting one in return.
I use the timer in one shot mode calling Timer.Change every time I want a new timeout period.
For every occurance of a timeout I'd like the timeout handler to have a different piece of information.
If I change the object I pass to the Timer on creation it doesn't seem to change when the handler executes.
Is the only way to do this to destroy the timer and create a new one?
Thanks,