[zeromq-dev] ROUTER socket and zmq_socket_monitor
Joel Lauener
Joel.Lauener at cern.ch
Wed Aug 7 15:53:16 CEST 2013
Hi Richard,
Thanks for your answer. I already receive the address but in the particular case of a router socket it's not that useful. I receive something like 'tcp://0.0.0.0:2000' which is the address to which the socket is bound.
My question was if there is a way to know what is the identity of the peer that has been disconnected (as set on the client side with the ZMQ_IDENTITY option). There are many connections behind a router. When I receive a disconnect event I need to know to which connection it belongs in order to take the correct action on the server (callback user code, cleanup resource, ..).
Cheers,
Joel.
Date: Mon, 5 Aug 2013 11:12:34 +0100
From: Richard_Newton at waters.com
Subject: Re: [zeromq-dev] ROUTER socket and zmq_socket_monitor
To: "ZeroMQ development list" <zeromq-dev at lists.zeromq.org>
Cc: zeromq-dev-bounces at lists.zeromq.org
Message-ID:
<OF242DDFB2.16EF4ADC-ON80257BBE.0037B5C6-80257BBE.00381560 at waters.com>
Content-Type: text/plain; charset="us-ascii"
Hi Joel,
The monitor event mechanism uses 2 sends to communicate, the first message contains the event details and fd, the second will contain the address, so
you need to do a second receive to get the address.
Apparently this was to make it easier for language bindings.
Ric.
From: "Joel Lauener" <Joel.Lauener at cern.ch>
To: "zeromq-dev at lists.zeromq.org" <zeromq-dev at lists.zeromq.org>
Date: 05/08/2013 11:02 AM
Subject: [zeromq-dev] ROUTER socket and zmq_socket_monitor
Sent by: zeromq-dev-bounces at lists.zeromq.org
Hi,
Currently I'm trying to setup a monitor on a ROUTER socket to detect clients disconnections. This system is put in place in addition to an heartbeat
mechanism in order to provide faster disconnection detection on the server side.
My problem now is that I effectively receive a ZMQ_EVENT_DISCONNECTED event from ZMQ, but the payload of this event only contains "fd" (file
descriptor I guess?). In such case is there a way to find the identity of the peer (as set on the client side using the ZMQ_IDENTITY option)?
Joel._______________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130807/eb0ec166/attachment.htm>
More information about the zeromq-dev
mailing list