Closed acalahorro closed 9 years ago
I think this is not possible, the zmq_socket_monitor() what RegisterMonitor wraps is not for this kind of things. You should handle this on the message level, create some heart beating mechanism, to keep track of the connected peers. See Chapter #4 of the guide for examples. The delphi examples of this chapter haven't linked into the guide, but some of them are already translated, and can be found here
Hello Mr.Vargas, thanks for your fast reply. In this case, for implementing a heart beat mechanism as poll, I will need refer the items of the connection array by fd, could be it?
Example in http://api.zeromq.org/3-2:zmq-poll:
/* Second item refers to standard socket 'fd' */ items[1].socket = NULL; items[1].fd = fd; items[1].events = ZMQ_POLLIN;
But, if I create the pollitems so, how I get the information in the MonitorCallback event? I haven't the ZMQSocket object because I only have the fd value. I have this doubt because in all the examples have using the zmq_recvmsg function.
Thank you very much in advance!
No, I mean don't use MonitorCallback
and fd
at all. In chapter4 it's very well described how to implement heartbeats.
I'm happy you find useful this project. :)
Hello Mr.Varga and Co! First of all, as always, thanks for this wonderful wrapper, it's fantastic for working in Delphi with zmq.
Now, my doubt.. I need know in my application when the client socket (dealer-connect) is disconnected of the server socket (router-bind). I have implemented the zmq_socket_monitor and I'm receiving events when a client connects or disconnects. The problem is that I don't know the client that does this action, I receive the field description (fd) in the event but it is different in the client and server for the same connection.
e.g. The fd obtained when I connect a client is 3732, but the fd obtained in the MonitorEvent of the server is 836.
Do you know if exists any solution to extract the identity of socket on the event monitor?
Thank you very much in advance! Regards.