|
Boost Users : |
Subject: Re: [Boost-users] [ASIO] Windows native type for ASIO serial port?
From: Christoph Gysin (christoph.gysin_at_[hidden])
Date: 2009-03-30 10:46:22
> I'm having trouble with my serial communication across the serial port, and
> want to get more diagnostic information by going to the native level. The
> serial port hangs occasionally on a synchronous read_some call, and I
> haven't been able to figure out why. Ideally, I'd like to build a timeout
> into the synchronous call.
AFAIK read_some() should only block if there is no data to read at
all. You could check for that with:
boost::asio::socket_base::bytes_readable command(true);
socket.io_control(command);
std::size_t bytes_readable = command.get();
Or you implement your own read() function with async_read() and
deadline_timer, like here:
http://lists.boost.org/Archives/boost/2007/04/120339.php
Chris
-- echo mailto: NOSPAM !#$.'<*>'|sed 's. ..'|tr "<*> !#:2" org_at_fr33z3
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