[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zeromq-dev
Subject:    Re: [zeromq-dev] Paranoid Pirate
From:       KIU Shueng Chuan <nixchuan () gmail ! com>
Date:       2014-08-26 14:33:52
Message-ID: CAP2skc-CfhiAxcfXDTVZENAMsBj_0gV=Y8C-+h42LSHPM2_0Vg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@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@gmail.com>
> Subject: Re: [zeromq-dev] Paranoid Pirate
> To: ZeroMQ development list <zeromq-dev@lists.zeromq.org>
> Message-ID:
>         <CAP2skc-=
> RLz92jXpXSAVmLFqRGAPjmoJh9Qn+b1yULAXfny+iw@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@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@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@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@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>

[Attachment #5 (text/html)]

<p dir="ltr">Okay, from the zguide, &quot;As a historical note, ZMQ v2.2 and earlier \
use UUIDs as identities, and ZMQ v3.0 and later use short integers.&quot;</p> <p \
dir="ltr">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.</p> <p dir="ltr">So now that identities are no longer uuids, they no longer \
get auto converted to c_strs and this doesn&#39;t work well with zmsg which only \
deals with c_strs.</p> <p dir="ltr">In short, you are using example code that relies \
on identities being UUIDs.</p> <p dir="ltr">Even if the example were to work, it \
wouldn&#39;t be very useful that only c_strs could be used, would it?</p> <div \
class="gmail_quote">On Aug 26, 2014 9:29 PM, &quot;Riskybiz&quot; &lt;<a \
href="mailto:riskybizlive@live.com">riskybizlive@live.com</a>&gt; wrote:<br \
type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 \
.8ex;border-left:1px #ccc solid;padding-left:1ex"> Is it these lines which are the \
problem with c_str() in  the Paranoid Pirate<br> Queue?<br>
<br>
msg.push_front((char*)identity.c_str());<br>
<br>
msg.wrap (it-&gt;identity.c_str(), NULL);<br>
<br>
What can be done to fix the problem, not using uuid identifiers?  Replacing<br>
uuids in the Paranoid Pirate Queue code with calls to s_set_id ()?<br>
<br>
But it begs the question; how should the uuid identifiers be properly<br>
handled and passed around in code?  Surely Paranoid Pirate pattern must have<br>
worked with uuids at some point in time otherwise how would it have passed<br>
muster for the zeromq guide?<br>
<br>
Confused.<br>
<br>
Riskybiz.<br>
<br>
<br>
Message: 8<br>
Date: Tue, 26 Aug 2014 06:15:54 +0800<br>
From: KIU Shueng Chuan &lt;<a \
                href="mailto:nixchuan@gmail.com">nixchuan@gmail.com</a>&gt;<br>
Subject: Re: [zeromq-dev] Paranoid Pirate<br>
To: ZeroMQ development list &lt;<a \
href="mailto:zeromq-dev@lists.zeromq.org">zeromq-dev@lists.zeromq.org</a>&gt;<br> \
Message-ID:<br>  &lt;CAP2skc-=<a \
href="mailto:RLz92jXpXSAVmLFqRGAPjmoJh9Qn%2Bb1yULAXfny%2Biw@mail.gmail.com">RLz92jXpXSAVmLFqRGAPjmoJh9Qn+b1yULAXfny+iw@mail.gmail.com</a>&gt;<br>
                
Content-Type: text/plain; charset=&quot;iso-8859-1&quot;<br>
<br>
The zmsg class api takes in char* and the pirate queue has code that passes<br>
it identities as c_str(). This doesn&#39;t work since identities are not nul<br>
terminated c strings and may contain nuls.<br>
<br>
It works for the workers only because they explicitly set their own id to<br>
something containing only characters. See s_set_id ().<br>
On 26 Aug 2014 04:33, &quot;Riskybiz&quot; &lt;<a \
href="mailto:riskybizlive@live.com">riskybizlive@live.com</a>&gt; wrote:<br> <br>
&gt; Dear zeromq developers,<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;                 I&#39;m trying to get the Paranoid Pirate pattern to<br>
&gt; operate on Debian Linux using zeromq-4.0.4.  (When I get it working on<br>
&gt; Linux then I will turn my attention to making it work on Windows).<br>
&gt; The Paranoid Pirate Queue &lt;<a href="http://pastebin.com/KTsn4Yq8" \
target="_blank">http://pastebin.com/KTsn4Yq8</a>&gt; and the<br> &gt; Paranoid Pirate \
Worker &lt;<a href="http://pastebin.com/hLHRC2LB" \
target="_blank">http://pastebin.com/hLHRC2LB</a>&gt; are<br> &gt; communicating and \
demonstrably heartbeating.  The problem is that the<br> &gt; Lazy Pirate Client \
&lt;<a href="http://pastebin.com/Ekd1ZGQF" \
target="_blank">http://pastebin.com/Ekd1ZGQF</a>&gt; does not appear to<br> &gt; \
communicate properly or receive a reply message. Is anyone able to<br> identify what \
is wrong here?<br> &gt; There are a couple of other necessary files; zhelpers.h<br>
&gt; &lt;<a href="http://pastebin.com/ir8bkQaU" \
target="_blank">http://pastebin.com/ir8bkQaU</a>&gt; and zmsg.hpp<br> &gt; &lt;<a \
href="http://pastebin.com/4KYir507" \
target="_blank">http://pastebin.com/4KYir507</a>&gt; .<br> &gt;<br>
&gt; I have changed int64_t more = 0; to  int more = 0; as kindly pointed<br>
&gt; out by KIU Shueng Chuan as being necessary for zeromq-3.2.x and<br>
&gt; higher.  Also added are some console print statements to trace what is<br>
&gt; actually going on.  In order to correct very long waiting times I have<br>
&gt; modified the delay periods built in to the pattern from those provided<br>
&gt; by the stock example in the zeromq guide.<br>
&gt;<br>
&gt; Hope someone is able to help.<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; Riskybiz.<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; zeromq-dev mailing list<br>
&gt; <a href="mailto:zeromq-dev@lists.zeromq.org">zeromq-dev@lists.zeromq.org</a><br>
&gt; <a href="http://lists.zeromq.org/mailman/listinfo/zeromq-dev" \
target="_blank">http://lists.zeromq.org/mailman/listinfo/zeromq-dev</a><br> &gt;<br>
&gt;<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL:<br>
<a href="http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140826/03acd436/a
ttachment-0001.htm" target="_blank">http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140826/03acd436/a<br>
 ttachment-0001.htm</a><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
zeromq-dev mailing list<br>
<a href="mailto:zeromq-dev@lists.zeromq.org">zeromq-dev@lists.zeromq.org</a><br>
<a href="http://lists.zeromq.org/mailman/listinfo/zeromq-dev" \
target="_blank">http://lists.zeromq.org/mailman/listinfo/zeromq-dev</a><br> <br>
<br>
End of zeromq-dev Digest, Vol 80, Issue 24<br>
******************************************<br>
<br>
_______________________________________________<br>
zeromq-dev mailing list<br>
<a href="mailto:zeromq-dev@lists.zeromq.org">zeromq-dev@lists.zeromq.org</a><br>
<a href="http://lists.zeromq.org/mailman/listinfo/zeromq-dev" \
target="_blank">http://lists.zeromq.org/mailman/listinfo/zeromq-dev</a><br> \
</blockquote></div>



_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic