On Wed, 2017-12-13 at 20:24 +0000, Stephen Gray wrote:
> Using CZMQ I'm trying to capture the routing identity frame of a
> message received off a ROUTER socket.  I see in the draft API that
> methods exist for this for a SERVER socket;
> 
> 
> 
> #ifdef CZMQ_BUILD_DRAFT_API
> 
> //  *** Draft method, for development use, may change without warning
> ***
> 
> //  Return message routing ID, if the message came from a ZMQ_SERVER
> socket.
> 
> //  Else returns zero.
> 
> CZMQ_EXPORT uint32_t
> 
>     zmsg_routing_id (zmsg_t *self);
> 
> 
> 
> //  *** Draft method, for development use, may change without warning
> ***
> 
> //  Set routing ID on message. This is used if/when the message is
> sent to a
> 
> //  ZMQ_SERVER socket.
> 
> CZMQ_EXPORT void
> 
>     zmsg_set_routing_id (zmsg_t *self, uint32_t routing_id);
> 
> 
> I believe my installation of CZMQ built the draft API; but I cannot
> work out how to access it in my code, is a pre-processor definition
> required?  Also do the these methods also work for ROUTER sockets?
> 
> Really though, I'd rather stick with the stable version. Please could
> someone enlighten me on how to get the identity frame using CZMQ?  I
> tried this:
> 
> //Inbound from ROUTER so will be carrying an identity frame
> zframe_t *identity = zframe_new_empty();
> identity = zmsg_pop(msgIn);//strip off id frame
> 
> but it crashes at runtime.
> 
> With thanks,
> 
> Stephen

You don't need any special API. From the zmq_socket manpage:

"When receiving messages a ZMQ_ROUTER socket shall prepend a message
part containing the routing id of the originating peer to the message
before passing it to the application."

-- 
Kind regards,
Luca Boccassi

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to