[zeromq-dev] XSUB/XPUB proper usage
Pieter Hintjens
ph at imatix.com
Mon Dec 29 17:03:33 CET 2014
On Mon, Dec 29, 2014 at 4:51 PM, Kenneth Adam Miller
<kennethadammiller at gmail.com> wrote:
> Now my questions: for xpub and xsub do you do the following:
> pub->setsockopt(ZMQ_SUBSCRIBE, "", 0);
No, this works only on SUB sockets.
> at all? Or does the following handle it completely:
> char *s = "xsubscriptionprefix";
> s[0]='\x01';
> sub->send(s);
Yes.
> Also is there a need for unsubscription upon closure of sub?
> char *s="\x00";
> sub->send(s);
Not needed at the SUB side at all; it's handled by the PUB socket. (I
think, from memory.)
-Pieter
More information about the zeromq-dev
mailing list