Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost.asio] Flush serial port buffers?
From: Igor R (boost.lists_at_[hidden])
Date: 2010-02-01 06:57:41


>> The problem is that the first transfer does not seem to complete before the baud rate switch and
>> thus is sent with the new baud rate, which is not supposed to happen.

If you use blocking write(), it doesn't return until the data is sent.
If your write is asynchronous, you should use its handler to get
notified when the data is sent.
But the fact that the data was sent, does not mean that it was
received by the device.
I'm not familiar with serial interfaces, but maybe there's some
buffering at the protocol/OS/driver level, which is out of ASIO
control. Perhaps, you have to define some acknowledge that the device
would send when it receives the data - and only after you get this ack
you'll change the baud-rate.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net