[zeromq-dev] ZMQ_FD and inproc:// socket

Justin Karneges justin at affinix.com
Thu Nov 17 03:17:43 CET 2016


What Max says is true, BUT there is actually a specific bug with inproc
sockets not working with ZMQ_FD.

(I'm the one that filed the original issue)

On Wed, Nov 16, 2016, at 05:59 PM, Max Kozlovsky wrote:
> Hi,
>
> It is kind of tricky.
>
> The availability of data on the file descriptor returned with ZMQ_FD
> signals that there is a zmq socket state change, i.e. the receive
> queue goes from empty to non-empty. Any operation on the socket
> (send/receive/getsockopt with ZMQ_EVENTS) may clear the notification.
> No further notifications will be received until there is another state
> change. This means the application has to continue sending/receiving
> data until getsockopt with ZMQ_EVENTS says further operations are not
> possible. The application should not access the file descriptor
> directly beyond using it as poll/epoll file descriptor.
>
> I am not familiar with boost::aio, but you'll need to do at least the
> following:
> 1) define your own read handler which is called when the file
>    descriptor signals data availability, which will call
>    zmq_msg_recv() on corresponding zmq socket.
> 2) either exhaust the incoming data completely each time read handler
>    is called, or somehow mark the file descriptor as having the data
>    available so your read handler is called again when the control is
>    returned to the library.
>
> Max
>
>
>
> On Tue, Nov 15, 2016 at 5:06 AM, Arnaud Kapp
> <kapp.arno at gmail.com> wrote:
>> Hello,
>>
>> I'm using zmqpp in my project, and I have a special case where I need
>> to integrate
>> with boost::asio (this is what azmq does, but for now I just need it
>> once, so I don't want
>> to switch libraries).
>>
>> The idea was to rely on ZMQ_FD and add the corresponding FD to ASIO's
>> event loop.
>> However, I've found that async_read_some() wasn't triggered. It turns
>> out it's likely an issue
>> in libzmq: https://github.com/zeromq/libzmq/issues/1434
>>
>> After taking a quick look at AZQM it seems it's also using ZMQ_FD.
>> Can anyone tell me what's the trick to get them to work?
>> Thanks,
>>
>>
>> --
>> Kapp Arnaud - Xaqq
>>
>>
>> _______________________________________________
>>  zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _________________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161116/488dea2d/attachment.htm>


More information about the zeromq-dev mailing list