[zeromq-dev] Exact matching for PUB/SUB

Serg V. Gulko s.gulko at gmail.com
Wed Oct 3 13:28:08 CEST 2012


Is there a way to do exact matching for SUB sockets? 
Looks like zmq treat "10" and "1" set as ZMQ_SUBSCRIBE as same identity.
    void *commands = zmq_socket(context_, ZMQ_PUB);
    zmq_bind(commands, "inproc://data");

    void *socket_1 = zmq_socket(context_, ZMQ_SUB);
    zmq_connect(socket_1, "inproc://data");
    zmq_setsockopt(socket_1, ZMQ_SUBSCRIBE, "1", 1);     
    void *socket_2 = zmq_socket(context_, ZMQ_SUB);
    zmq_connect(socket_2, "inproc://data");
    zmq_setsockopt(socket_2, ZMQ_SUBSCRIBE, "10", 2);      
When I send data into PUB socket with key "1" data(for socket 1) also
appears on socket_2. 
I know that this is what described in manual but is there a way to make
automatic matching(without comparing data from key manually)?

Linux, ZMQ 2.2.0

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20121003/d1873ebb/attachment.htm>

More information about the zeromq-dev mailing list