[zeromq-dev] Paranoid Pirate

KIU Shueng Chuan nixchuan at gmail.com
Tue Aug 26 16:33:52 CEST 2014


Okay, from the zguide, "As a historical note, ZMQ v2.2 and earlier use
UUIDs as identities, and ZMQ v3.0 and later use short integers."

And looking closer at zmsg.hpp, the recv() method automatically converts
message parts that look like uuids to printable c_strs. The send() method
does the reverse.

So now that identities are no longer uuids, they no longer get auto
converted to c_strs and this doesn't work well with zmsg which only deals
with c_strs.

In short, you are using example code that relies on identities being UUIDs.

Even if the example were to work, it wouldn't be very useful that only
c_strs could be used, would it?
On Aug 26, 2014 9:29 PM, "Riskybiz" <riskybizlive at live.com> wrote:

> Is it these lines which are the problem with c_str() in  the Paranoid
> Pirate
> Queue?
>
> msg.push_front((char*)identity.c_str());
>
> msg.wrap (it->identity.c_str(), NULL);
>
> What can be done to fix the problem, not using uuid identifiers?  Replacing
> uuids in the Paranoid Pirate Queue code with calls to s_set_id ()?
>
> But it begs the question; how should the uuid identifiers be properly
> handled and passed around in code?  Surely Paranoid Pirate pattern must
> have
> worked with uuids at some point in time otherwise how would it have passed
> muster for the zeromq guide?
>
> Confused.
>
> Riskybiz.
>
>
> Message: 8
> Date: Tue, 26 Aug 2014 06:15:54 +0800
> From: KIU Shueng Chuan <nixchuan at gmail.com>
> Subject: Re: [zeromq-dev] Paranoid Pirate
> To: ZeroMQ development list <zeromq-dev at lists.zeromq.org>
> Message-ID:
>         <CAP2skc-=
> RLz92jXpXSAVmLFqRGAPjmoJh9Qn+b1yULAXfny+iw at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> The zmsg class api takes in char* and the pirate queue has code that passes
> it identities as c_str(). This doesn't work since identities are not nul
> terminated c strings and may contain nuls.
>
> It works for the workers only because they explicitly set their own id to
> something containing only characters. See s_set_id ().
> On 26 Aug 2014 04:33, "Riskybiz" <riskybizlive at live.com> wrote:
>
> > Dear zeromq developers,
> >
> >
> >
> >                 I'm trying to get the Paranoid Pirate pattern to
> > operate on Debian Linux using zeromq-4.0.4.  (When I get it working on
> > Linux then I will turn my attention to making it work on Windows).
> > The Paranoid Pirate Queue <http://pastebin.com/KTsn4Yq8> and the
> > Paranoid Pirate Worker <http://pastebin.com/hLHRC2LB> are
> > communicating and demonstrably heartbeating.  The problem is that the
> > Lazy Pirate Client <http://pastebin.com/Ekd1ZGQF> does not appear to
> > communicate properly or receive a reply message. Is anyone able to
> identify what is wrong here?
> > There are a couple of other necessary files; zhelpers.h
> > <http://pastebin.com/ir8bkQaU> and zmsg.hpp
> > <http://pastebin.com/4KYir507> .
> >
> > I have changed int64_t more = 0; to  int more = 0; as kindly pointed
> > out by KIU Shueng Chuan as being necessary for zeromq-3.2.x and
> > higher.  Also added are some console print statements to trace what is
> > actually going on.  In order to correct very long waiting times I have
> > modified the delay periods built in to the pattern from those provided
> > by the stock example in the zeromq guide.
> >
> > Hope someone is able to help.
> >
> > Thanks,
> >
> > Riskybiz.
> >
> >
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
>
> http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140826/03acd436/a
> ttachment-0001.htm
>
> ------------------------------
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
> End of zeromq-dev Digest, Vol 80, Issue 24
> ******************************************
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140826/d8c49b57/attachment.html>


More information about the zeromq-dev mailing list