[zeromq-dev] [Fwd: Re: socket call back when using the zmq_loop]

Petitdemange Sébastien sebastien.petitdemange at esrf.fr
Sat Dec 19 20:11:34 CET 2009


Jon Dyte a écrit :
> On Friday 18 Dec 2009, Petitdemange Sébastien wrote:
>
>   
>> First thanks a lot for your quick replay.
>>
>> In fact what I want to do is more like that:
>>
>> zmq::socket_t s1 (ctx, ZMQ_SUB);
>> zmq::socket_t s2 (ctx, ZMQ_SUB);
>>
>> s1.connect ("tcp://server001:5555");
>> s1.setsockopt (ZMQ_SUBSCRIBE, "abc.*", 5);
>>
>> s2.connect ("tcp://server002:5555");
>> s2.setsockopt (ZMQ_SUBSCRIBE, "def.*", 5);
>>
>>     
>
> so you do not want to get def.* messages from server001:5555
> nor abc.* messages from  server002:5555
>
> if you have control of the publishing topic space on the ZMQ_PUB
> side you could add the source indicator to the topic, say s1 and s2,
>
> then Martin's example would become (caveat, completely untested)
>
>  zmq::socket_t s (ctx, ZMQ_SUB);
> s.connect ("tcp://server001:5555");
> s.connect ("tcp://server002:5555");
> s.setsockopt (ZMQ_SUBSCRIBE, "S1abc.*", 5); // from server 1
> s.setsockopt (ZMQ_SUBSCRIBE, "S2def.*", 5); // from server 2
>
> while (true)
> {
>
> .....
>
>
> Jon
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>   
Thanks a lot Jon, I didn't know that 1 soket could do multiple 
filtering... Sorring for that.

SEB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20091219/9bbe3c8c/attachment.html>


More information about the zeromq-dev mailing list