|
Boost Users : |
Subject: Re: [Boost-users] Boost.Asio, 0MQ, and Windows
From: Damien Kick (dkick_at_[hidden])
Date: 2013-08-12 14:50:24
Damien Kick <dkick <at> shoretel.com> writes:
> <sigh/> It's so annoying because I have this feeling that there is
> probably just one stupid little conversion function that I need to
> be calling but it continues to elude me :(
And ... that missing conversion function was simply a mother father
Chinese dentist cast. <sigh/> I had managed to get lost in the swirl
of GetStdHandle, DuplicateHandle, WSADuplicateSocket, and the odd
_open_osfhandle ... But then, after all of that fuss, I find that:
zmq::context_t zenv(1);
zmq::socket_t zocket(zenv, ZMQ_PUSH);
SOCKET zfd;
std::size_t zfd_size = sizeof(zfd);
zocket.getsockopt(ZMQ_FD, &zfd, &zfd_size);
HANDLE handle = (HANDLE)zfd;
boost::asio::io_service ios;
boost::asio::windows::stream_handle io(ios, handle);
io.async_read_some(
boost::asio::null_buffers(),
[](const boost::system::error_code& err, std::size_t) { });
Does not compile:
2>.../stream_handle_service.hpp(195): error C2248: \
'boost::asio::detail::win_iocp_handle_service::async_read_some' : \
cannot access private member declared in class \
'boost::asio::detail::win_iocp_handle_service'
Sure enough, I find ...
class win_iocp_handle_service
{
private:
// Prevent the use of the null_buffers type with this service.
// [... snip ...]
template <typename Handler>
void async_read_some(implementation_type& impl,
const null_buffers& buffers, Handler& handler);
// [... snip ...]
};
And so, unless I'm once again missing something obvious (like casting
a SOCKET into a HANDLE), it doesn't seem that the approach of using
the ZMQ_FD and boost::asio::null_buffers is going to work for me on
both POSIX and Windows.
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