[zeromq-dev] Trouble sending from ROUTER to DEALER
KIU Shueng Chuan
nixchuan at gmail.com
Mon Sep 15 17:12:29 CEST 2014
Well on my system the following line
"printf("identity frame size: %ld bytes\n", zmq_msg_size(&messageIn));"
inserted before your line in multiPartMsg.h
"id = *(static_cast<int*>(zmq_msg_data(&messageIn)));"
yields "5 bytes".
The code at
https://github.com/zeromq/libzmq/blob/master/src/router.cpp#L465
seems to indicate that automatically generated identities are 5-bytes in
length.
On Mon, Sep 15, 2014 at 7:16 PM, Riskybiz <riskybizlive at live.com> wrote:
> I made a quick modification to check the size of the received identity
> frame. It shows as 32 bits. Console output is:
>
>
>
> router: Preparing
>
> router: Ready to receive
>
> --------------------------- Message Received ---------------------------
>
> Originator Identity: 32768 Size of identity frame: 32bits
>
> Frame Vector Index: 0 Frame Data: Frame1
>
> Frame Vector Index: 1 Frame Data: Frame2
>
> Frame Vector Index: 2 Frame Data: Frame3
>
> Frame Vector Index: 3 Frame Data: Frame4
>
> ------------------------------------------------------------------------
>
> MultiPartMessage: Sending to connection identity: 32768 Size of identity:
> 32bits
>
>
>
> router: Ready to receive
>
>
>
>
>
> Date: Mon, 15 Sep 2014 10:44:46 +0800
>
> From: KIU Shueng Chuan <nixchuan at gmail.com>
>
> Subject: Re: [zeromq-dev] Trouble sending from ROUTER to DEALER
>
> To: ZeroMQ development list <zeromq-dev at lists.zeromq.org>
>
> Message-ID:
>
> <
> CAP2skc-L543rQTFv1+n_=fV31M60FPQfVpFpZsV8B=zn554=Hw at mail.gmail.com>
>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
>
> You may want to check whether the received identity frame is only 32-bits
> in length.
>
> On 15 Sep 2014 02:30, "Riskybiz" <riskybizlive at live.com> wrote:
>
>
>
> > Dear zeromq developers,
>
> >
>
> >
>
> >
>
> > I've created a couple of simple Windows C++ console programs
>
> > zmqDealerClient <http://pastebin.com/1AqWXbTG> & zmqRouter
>
> > <http://pastebin.com/jD4LsUKU> to understand zeromq (4.0.4)
>
> > ROUTER-DEALER connections. Both use the header file multiPartMessage
>
> > <http://pastebin.com/hhKDamzt> to handle the preparation, sending and
>
> > receiving of multipart messages. I can get a message to pass from the
>
> > DEALER to the ROUTER with the resultant console output of:
>
> >
>
> >
>
> >
>
> > router: Preparing
>
> >
>
> > router: Ready to receive
>
> >
>
> > --------------------------- Message Received
>
> > ---------------------------
>
> >
>
> > Originator Identity: 32768
>
> >
>
> > Frame Vector Index: 0 Frame Data: Frame1
>
> >
>
> > Frame Vector Index: 1 Frame Data: Frame2
>
> >
>
> > Frame Vector Index: 2 Frame Data: Frame3
>
> >
>
> > Frame Vector Index: 3 Frame Data: Frame4
>
> >
>
> > ----------------------------------------------------------------------
>
> > --
>
> >
>
> > MultiPartMessage: Sending to connection identity: 32768
>
> >
>
> > router: Ready to receive
>
> >
>
> >
>
> >
>
> > However when zmqRouter attempts to send a reply from ROUTER back to
>
> > the originating DEALER then the message is not getting through
>
> > properly and the zmqDealerClient output stalls at;
>
> >
>
> >
>
> >
>
> > dealerClient: Preparing
>
> >
>
> > dealerClient: Dealer Socket Ready
>
> >
>
> > dealerClient: MultiPartMessage Sent
>
> >
>
> > dealerClient: Awaiting Reply
>
> >
>
> >
>
> >
>
> > Along with the following error messages from zmqRouter;
>
> >
>
> >
>
> >
>
> > [9668] MultiPartMessage: Error Sending Identity Message Part: Unknown
>
> > error
>
> >
>
> > [9668] MultiPartMessage: Error Sending Regular Message Part: Unknown
>
> > error
>
> >
>
> > [9668] MultiPartMessage: Error Sending Regular Message Part: Unknown
>
> > error
>
> >
>
> > [9668] MultiPartMessage: Error Sending Regular Message Part: Unknown
>
> > error
>
> >
>
> >
>
> >
>
> > The multi part message being sent via the ROUTER to the DEALER is
>
> > prepended with the identity of the DEALER socket, I'm unsure of the
>
> > problem here; can anyone explain what I've done wrong?
>
> >
>
> >
>
> >
>
> > Also I notice that if I run two instances of zmqDealerClient in
>
> > separate console windows, both connecting to the same instance of
>
> > zmqRouter, then both clients appear to have the same identity. The
>
> > code I've written uses the default situation where the ROUTER socket
>
> > sets the identities internally. I expected each instance to have a
>
> > unique identity. Anyone know why this is not the case?
>
> >
>
> >
>
> >
>
> > With 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: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140915/cf860685/attachment.htm>
More information about the zeromq-dev
mailing list