Cancel async_read due to timeout
问题 I'm trying to write a wrapper synchronous method around async_read to allow non blocking reads on a socket. Following several examples around internet I have developed a solution that seems to be almost right but which is not working. The class declares these relevant attributes and methods: class communications_client { protected: boost::shared_ptr<boost::asio::io_service> _io_service; boost::shared_ptr<boost::asio::ip::tcp::socket> _socket; boost::array<boost::uint8_t, 128> _data; boost: