There's no really complete example in the guide with source for usage of an
XSUB/XPUB combination that I could find. So I have some questions:
Suppose the following is how I set up the XPub & XSub sockets:
_xpub = new zmq::socket_t(_context, ZMQ_XPUB);
_xpub->bind("inproc://killpub");
_xsub = new zmq::socket_t(_context, ZMQ_XSUB);
_xsub->bind("inproc://killsub");
//These sockets are created and bound in the constructor of a static
singleton
//This static singleton also creates the context. It also manages their
destruction
//later ...
sub->connect("inproc://killpub");
pub->connect("inproc://killsub");
Now my questions: for xpub and xsub do you do the following:
pub->setsockopt(ZMQ_SUBSCRIBE, "", 0);
at all? Or does the following handle it completely:
char *s = "xsubscriptionprefix";
s[0]='\x01';
sub->send(s);
where messages sent by pub that start with subscriptionprefix will be
forwarded to sub?
Also is there a need for unsubscription upon closure of sub?
char *s="\x00";
sub->send(s);
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev