Min, Why is the null-message delimiter needed?
Brian On Fri, Sep 3, 2010 at 9:47 AM, MinRK <[email protected]> wrote: > Yes, I believe REQ should work with a null-message delimiter, if that fits > your send pattern: > xrep.send_multipart(['a', '', 'the message']) > > On Fri, Sep 3, 2010 at 02:55, Naveen Chawla <[email protected]> wrote: >> >> This is perfect for my system, and clever, thank you. >> >> (btw can the target be REQ? I understand that messaging REQ from XREP >> requires a "delimiter" but isn't this just an empty message?) >> >> On 3 September 2010 01:44, MinRK <[email protected]> wrote: >> > Hello, >> > You can do this with XREP and PAIRs (or XREQs). Just set the IDENTITY of >> > the >> > receivers with setsockopt, and send the same thing as the first part >> > each >> > message from the XREP socket. >> > For instance: >> > (this is for Python bindings, but similar in C/C++) >> > addr = 'tcp://127.0.0.1:12345' >> > >> > x = ctx.socket(XREP) >> > x.bind('tcp://127.0.0.1:12345') >> > a = ctx.socket(PAIR) >> > a.setsockopt(IDENTITY, 'a') >> > a.connect(addr) >> > b = ctx.socket(PAIR) >> > b.setsockopt(IDENTITY, 'b') >> > b.connect(addr) >> > x.send_multipart(['a', 'hi a', 'from x']) >> > x.send_multipart(['b', 'hi b') >> > a.recv_multipart() >> > [ 'hi a', 'from x' ] >> > b.recv() >> > 'hi b' >> > >> > You could also have symmetric p2p messaging through a central server if >> > you >> > use a modified version of the Queue device with a single XREP socket >> > that >> > swaps the first two parts of a multipart message (to get identity order >> > correct). >> > -MinRK >> > On Thu, Sep 2, 2010 at 13:07, Naveen Chawla <[email protected]> >> > wrote: >> >> >> >> I want to be able to message certain peers by identity. >> >> >> >> Can I set the identity using setsocketopt, and then use that identity >> >> number from the originator-side as part of a multi-part message, to >> >> target that socket? >> >> >> >> What do I need to put in that message to do this? >> >> >> >> N >> >> _______________________________________________ >> >> zeromq-dev mailing list >> >> [email protected] >> >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> > >> > >> > _______________________________________________ >> > zeromq-dev mailing list >> > [email protected] >> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev >> > >> > >> _______________________________________________ >> zeromq-dev mailing list >> [email protected] >> http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > -- Brian E. Granger, Ph.D. Assistant Professor of Physics Cal Poly State University, San Luis Obispo [email protected] [email protected] _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
