Boost logo

Boost Users :

Subject: Re: [Boost-users] [Asio] Need help making a custom service
From: Kyle Edwards (kedwards_at_[hidden])
Date: 2015-03-09 16:34:57


Hi Bjorn,

Thanks for the quick reply.

On Mon, 2015-03-09 at 21:21 +0100, Bjorn Reese wrote:
> Then you can wrap your file descriptor in a posix::stream_descriptor
> [1] and wait on events using async_read_some() with null_buffers() [2].
>
> An example can be found in [3]. The example assumes that the wrapper
> does not take ownership of the file descriptor (if it does, then you
> can omit the non_closing_service.)

Thanks for the suggestion. Unfortunately, though, I don't think
async_read_some() is going to work for me. Here is an excerpt from
boost/asio/detail/reactive_descriptor_service.hpp:

  template <typename Handler>
  void async_read_some(implementation_type& impl,
      const null_buffers&, Handler handler)
  {
    // ...
    start_op(impl, reactor::read_op, p.p, false, false);
    // ...
  }

Notice the use of reactor::read_op. I've done a little more digging
through the Boost.Asio code, and it looks like, for this application, I
need to use reactor::except_op instead. Is there a simple class/function
that does this? Or will I have to implement it myself?

Kyle


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