public NetMQMonitor(NetMQContext context, NetMQSocket monitoredSocket, string endpoint, SocketEvent eventsToMonitor)
        {
            Endpoint = endpoint;
            Timeout  = TimeSpan.FromSeconds(0.5);

            ZMQ.SocketMonitor(monitoredSocket.SocketHandle, Endpoint, eventsToMonitor);

            MonitoringSocket = context.CreatePairSocket();
            MonitoringSocket.Options.Linger = TimeSpan.Zero;

            MonitoringSocket.ReceiveReady += Handle;

            m_isOwner = true;
        }
示例#2
0
        public void Monitor(string endpoint, SocketEvent events = SocketEvent.All)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException("endpoint");
            }

            if (endpoint == string.Empty)
            {
                throw new ArgumentException("Unable to publish socket events to an empty endpoint.", "endpoint");
            }

            ZMQ.SocketMonitor(SocketHandle, endpoint, events);
        }