Whoops ... forgot to start the read again in the completion handler. "Fixed" below. Michael Caisse wrote:
void my_message_maker::read_start() { serial_port.async_read_some( boost::asio::buffer( in_message, MAX_MESSAGE_SIZE ), boost::bind( &my_message_maker::read_done, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred ) ); }
void my_message_maker::read_done( const boost::system::error_code& error, int bytes_transferred ) { if( !error ) { for( int i=0; i < bytes_transferred; ++i ) { if( in_message[ i ] == STX ) { my_message.clear(); } else if( in_message[ i ] == ETX ) { make_callback( my_message ); } else { my_message += in_message[ i ]; }
read_start(); }
} else { close_port( error ); } }
-- ---------------------------------- Michael Caisse Object Modeling Designs www.objectmodelingdesigns.com