I believe it's been mooted before, and ZMQ_STREAM sockets do this, sending null messages to signal when there's a new client connection and/or a disconnected client.
On Wed, Jul 2, 2014 at 2:08 PM, Goswin von Brederlow <[email protected]> wrote: > On Tue, Jul 01, 2014 at 06:23:41PM +0200, Pieter Hintjens wrote: >> On Tue, Jul 1, 2014 at 4:46 PM, Goswin von Brederlow <[email protected]> >> wrote: >> >> > 1) with ROUTER/DEALER I don't get a message when a subscriber >> > disconnects without unsubscribing. >> > >> > Eventualy the heartbeat will get it but that can take a long time and >> > a lot of messages can queue up inbetween for no good reason. >> >> There is no other way, in practice. Even if libzmq reports the TCP >> disconnect, there are cases where the network connection will block >> and die without reporting an error. You must eventually use >> heartbeats. You can tune these to a few seconds. > > But with tcp there is a way. And (X)PUB/(X)SUB do use it. I know it > isn't totaly reliable since it can't catch kernel or network crashes > in a timely fashion. But 99.999% of cases will properly close the tcp > socket. > > The goal is to catch the common case early while still handling the > exceptional one with heartbeats. > >> > So I tried using a monitor socket. But that only gives me the FD and >> > address of the receiving socket: >> >> No use IMO. >> >> > 2) with XPUB/XSUB the CURVE metadata seems to get lost >> > >> > zmq_msg_gets() always returns Null it seems. I think the problem is >> > that zmq::xpub_t::xread_activated just appends the message data to its >> > internal std::deque. A ROUTER socket on the other hand attaches the >> > pipe to its fair queue. >> > >> > Should this be rewritten to use a fair queue too? >> >> That would make sense, yes. >> >> -Pieter > > MfG > Goswin > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
