
On 08/09/2013 08:34 PM, Damien Kick wrote:
zocket.getsockopt(ZMQ_FD, &zfd, &zfd_size); boost::asio::io_service ios; boost::asio::windows::stream_handle io(ios, zfd);
And the error I get when I try to compile it.
2>Z:\zee-zmq-socket.cpp(14): error C2664: \ 'boost::asio::windows::basic_stream_handle<>::basic_stream_handle(\ boost::asio::io_service &,void *const &)' : cannot convert parameter \ 2 from 'SOCKET' to 'void *const &' 2> Reason: cannot convert from 'SOCKET' to 'void *const ' 2> Conversion from integral type to pointer type requires \ reinterpret_cast, C-style cast or function-style cast
Boost.Asio uses native_handle_type, which is a wrapper class for the underlying socket type. In the case of Windows this is SOCKET. However, you probably need to go via a intermediary variable: boost::asio::windows::stream_handle::native_handle_type handle(zfd); boost::asio::windows::stream_handle io(ios, handle); Disclaimer: I have not compiled it. You may need to include something from detail to make it work, or it may not work at all ;-)
And so I'm worried there might be other gotchas about which I might not know and which would not even be so polite as to manifest themselves as compile-time errors. Thank you in advance for any help.
Make sure to use null_buffers: http://www.boost.org/doc/html/boost_asio/overview/core/reactor.html