Peleg wrote:
Hello, I'm writing an Asio based serial port communication application. I've tried to use Asio timer as receive time out timer. The implementation consist of restarting the timer each time the receive event is called, , so it'll trigger only after time out duration with no receive event. The problem is that when I try to restart the timer, using expires_from_now(), the timer immediately triggers.
You are not getting asynchronous timeouts, all you are seeing is the first timer being cancelled when you queue the second. All asio async actions happen in the context of the io_service, you need to call io_service.run() somewhere. You have either oversimplified your example or you need to re-read the asio examples. HTH Bill Somerville ...
How do I restart to timer in the right way?
Thanks, Peleg