I don't know boost::asio, but the justification provided in your link to use it with 0MQ is the need to interface with a normal TCP socket. Now, you have the STREAM transport available in 0MQ which is exactly for this purpose. You may not have noticed it because it is very recent.

Cheers,

Laurent.


Le 09/08/2013 23:44, Damien Kick a écrit :
I have been following the excellent advice on using 0MQ and Boost.Asio
on a POSIX-ish platform (MacOS) at
<http://preview.tinyurl.com/jw4krek>.  Unfortunately, though, I am
writing code which needs to work on both POSIX-ish and Windows.  I'm
not having much luck, so far, with my attempts to translate this
advice to the Windows side.  I can't seem to figure out how to match
the type returned by getsockopt(ZMQ_FD) on Windows and what I think
should be the Windows equivalents of
boost::asio::posix::stream_descriptor.  Here is what I've tried:


     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);
     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

So far, my Google-fu has been weak; I can only seem to find examples
which deal with Boost.Asio and 0MQ on POSIX-ish.  I'm not sure what I
need to do to correctly get from a SOCKET to a `void * const`.  The
closest advice that I've been able to find is about combining 0MQ and
libcurl: <http://preview.tinyurl.com/lbffx64>.  And this advice also
makes me nervous that my compilation problems are only the tip of a
much nastier iceberg hiding under the surface.  In particular,

The reason why there is a assign, but no release-function for
boost::asio::ip::tcp::sockets is that once a socket is "bound" to a
completion port you cannot "unbound" it or "bound" it to another
completion-port.
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.


________________________________

This e-mail and any attachments are confidential. If it is not intended for 
you, please notify the sender, and please erase and ignore the contents.
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to