[zeromq-dev] How to get client's identity

Bharat Somani bharatdsomani at gmail.com
Wed Jul 20 14:47:37 CEST 2016


Hi David,

Thanks for your reply.

Gone through your message, but I am still not able to figure out the API to
be used for add & retrieve metadata in the message.

Do anyone know how to add/retrieve the metadata  in/from the message?

Also what all properties are supported in zmq_msg_set()

Thanks in advance.

Regards,
Bharat



On Wed, Jul 20, 2016 at 4:14 PM, David Jelenc <david.jelenc at fri.uni-lj.si>
wrote:

> Bharat,
>
> unfortunately, I do not have an example at hand. AFAIK, it was fairly
> straightforward. I was using zmqpp bindings:
>
> - you set up a ZAP handler that authenticates clients (CURVE in my case),
> - then, whenever a client connects, ZAP handler authenticates it,
> - and from then on each message is equipped with additional properties
> describing the client.
>
> See this thread for some more pointers:
>
> http://lists.zeromq.org/mailman/private/zeromq-dev/2016-May/030487.html
> (read it bottm-up)
>
> Best,
> David
>
> PS Just to be clear -- PUSH and PULL sockets still won't have the identity
> property, but you should be able to identify clients based on their
> credentials.
>
> On 20. 07. 2016 07:39, Bharat Somani wrote:
>
>> Hi,
>>
>> Can you point to any API/example which will facilitate the addition of
>> key-value (meta-data) pairs in the message sent from client?
>> I tried to search with respect to ZAP and found that it only facilitates
>> the type of authentication to be used. But I am not able to locate any
>> API which add/retrieve the key value pairs.
>>
>>
>> Regards,
>> Bharat
>>
>> On Tue, Jul 19, 2016 at 7:17 PM, David Jelenc
>> <david.jelenc at fri.uni-lj.si <mailto:david.jelenc at fri.uni-lj.si>> wrote:
>>
>>     Another option would also be to use ZAP to authenticate clients.
>>     Once a client is authenticated, key-value (meta-data) pairs are
>>     added to each message so you always know whom each message came from.
>>
>>     On 19. 07. 2016 15:45, Diego Fons wrote:
>>
>>         Hi,
>>
>>         ZMQ_IDENTITY is used only with DEALER socket. You can not
>>         retrive client
>>         information with PUSH/PULL sockets (they are not implemented for
>>         this).
>>
>>         You can:
>>         1) Re-implement your application to use DEALER/ROUTER or
>>         2) Implement an abstraction layer that provides client
>>         identification
>>         (ie. build your own protocol).
>>
>>         I'd choose the first one, but I don't know the main purpose of the
>>         application.
>>
>>         Regards.
>>
>>         On Tue, Jul 19, 2016 at 9:31 AM, Bharat Somani
>>         <bharatdsomani at gmail.com <mailto:bharatdsomani at gmail.com>
>>         <mailto:bharatdsomani at gmail.com
>>
>>         <mailto:bharatdsomani at gmail.com>>> wrote:
>>
>>
>>              Hi All,
>>
>>              I have a process A which is creating ZMQ_PULL type of
>>         socket and
>>              bind on some port.
>>
>>              Now I have process B, C, D (all on same system) which all
>>         creates
>>              ZMQ_PUSH types of sockets in each process respectively and
>>         connects
>>              to the port on same system on which process A is bind to.
>>
>>              In process A I am using API zmq_msg_recv() for receiving the
>>              messages. Now I want to identify the process (A or B or C)
>> from
>>              which that message is received.
>>              is there any way to know which process has sent this message?
>>
>>              I tried to set the ZMQ_IDENTITY in client processes (B,C &
>>         D) but
>>              dont know how to get the identity from received message on
>> the
>>              server process A
>>
>>              Any pointer in this regard?
>>
>>
>>
>>              --
>>              With warm regards,
>>              Bharat
>>
>>              _______________________________________________
>>              zeromq-dev mailing list
>>         zeromq-dev at lists.zeromq.org <mailto:zeromq-dev at lists.zeromq.org>
>>         <mailto:zeromq-dev at lists.zeromq.org
>>         <mailto:zeromq-dev at lists.zeromq.org>>
>>         http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>>
>>
>>         --
>>         Diego Andrés Fons
>>         Intraway Corp.
>>         Solution Developer
>>         AR Office: +54 (11) 6040 4000
>>         US Office: +1 (516) 620 3890
>>         Email: diego.fons at intraway.com <mailto:diego.fons at intraway.com>
>>         <mailto:diego.fons at intraway.com <mailto:diego.fons at intraway.com>>
>>
>>         Visit our website at http://www.intraway.com
>>         <http://www.intraway.com/>
>>         Proud to be an ISO 9001:2008 certified company
>>
>>
>>         _______________________________________________
>>         zeromq-dev mailing list
>>         zeromq-dev at lists.zeromq.org <mailto:zeromq-dev at lists.zeromq.org>
>>         http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>     _______________________________________________
>>     zeromq-dev mailing list
>>     zeromq-dev at lists.zeromq.org <mailto:zeromq-dev at lists.zeromq.org>
>>     http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



-- 
With warm regards,
Bharat Somani
M +91 7588877776
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160720/f62cbd81/attachment.html>


More information about the zeromq-dev mailing list