[zeromq-dev] Trouble sending from ROUTER to DEALER

Riskybiz riskybizlive at live.com
Thu Sep 18 17:50:59 CEST 2014


Thanks for the comments.

 

I’ve modified the simple example (C++) programs:

 

zmqRouter <http://pastebin.com/jD4LsUKU> 

zmqDealerClient <http://pastebin.com/1AqWXbTG> 

 

and included header file

 

multiPartMessage.h <http://pastebin.com/hhKDamzt> 

 

 

to extract the ROUTER generated identity (a blob of data) from the z_msg_t
object and store it as a std::string.  Sadly this does not give a working
solution.  Output is:

 

router: Preparing

router: Ready to receive

--------------------------- Message Received ---------------------------

Originator Identity:  Ç  ) Identity Message Size: 5bytes or 40bits

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

Frame Vector Index: 4 Frame Data: Frame5

------------------------------------------------------------------------

router: Ready to receive

 

Note the garbled ‘Originator Identity’.

 

Does anyone know how to make this example work? Just need to get hold of the
identity, store it and make use of it later?

 

Alternatively I’ve  read
<http://stackoverflow.com/questions/10023547/manipulating-blobs-in-c>  that
a std::vector <unsigned char> can be used to receive a blob of data.  Anyone
know how to get the message payload out of the z_msg_t object into a
std::vector <unsigned char> and then copied back into a different z_msg_t
object.  

 

Thanks,

 

Riskybiz.

 

P.S.  Necessity dictates that I use Windows for this work, sadly the CMZQ
Visual Studio 2013 & 2012 projects will not build on Windows 7, 64 bit.
Tried up to GitHub Merge pull request #651 a few days ago.  Really need C++
too. J

 

----------------------------------------------------------------------------
----------------------------------------------

Date: Wed, 17 Sep 2014 20:39:55 +0200

From: Pieter Hintjens <ph at imatix.com>

Subject: Re: [zeromq-dev] Trouble sending from ROUTER to DEALER

To: ZeroMQ development list <zeromq-dev at lists.zeromq.org>

Message-ID:

 
<CADL5_siAk1_s_i3MuRvGsghtdMjdXK=9WNx7ULOJ3qgm5pi7Vg at mail.gmail.com>

Content-Type: text/plain; charset=UTF-8

 

It is fairly simple:

 

- use CZMQ and switch from C++ to C (:-)

- use zframe_recv or zmsg_recv and zmsg_pop

 

-Pieter

 

Date: Thu, 18 Sep 2014 09:42:39 +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:

 
<CAP2skc9CZ_DGy8J4S6g=pJS13ujT2KRbOCWYXT5zmdvcb=O-bA at mail.gmail.com>

Content-Type: text/plain; charset="iso-8859-1"

 

You already use a std::string to store the non-identity parts of the
multi-part message. Why not use the same data type for the identity part?

 

The identity and non-identity parts are just data blobs.

-------------- next part --------------

An HTML attachment was scrubbed...

URL:
http://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140918/16c66bdd/a
ttachment-0001.htm 

 

------------------------------

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140918/98d2ef25/attachment.htm>


More information about the zeromq-dev mailing list