[zeromq-dev] 0MQ, Boost.Asio, and Windows
Damien Kick
dkick at shoretel.com
Tue Aug 13 22:38:32 CEST 2013
I'm very excited because I think I found a way to accomplish on
Windows what I'd managed to get to work for me on POSIX, more or less.
This at least compiles and if I'm correctly understanding the
documentation for these functions that I've found online, then this
might even do the Right Thing (TM) at runtime. Thanks in advance if
anyone can help review this; i.e. somebody is already familiar with
these Windows functions.
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);
auto event_handle = CreateEvent(
nullptr, // default security settings
false, // automatic reset
false, // initial state is unsignalled
nullptr); // anonymous object
assert(event_handle != nullptr);
auto err = WSAEventSelect(zfd, event_handle, FD_READ);
assert(!err);
boost::asio::io_service ios;
boost::asio::windows::object_handle io(ios, event_handle);
io.async_wait(
[](const boost::system::error_code& err) { });
More information about the zeromq-dev
mailing list