public void Monitor(String addr, SocketEvent events) { if (m_ctxTerminated) { throw TerminatingException.Create(); } // Support deregistering monitoring endpoints as well if (addr == null) { StopMonitor(); return; } string address; string protocol; DecodeAddress(addr, out address, out protocol); CheckProtocol(protocol); // Event notification only supported over inproc:// if (!protocol.Equals("inproc")) { throw NetMQException.Create(ErrorCode.EPROTONOSUPPORT); } // Register events to monitor m_monitorEvents = events; m_monitorSocket = Ctx.CreateSocket(ZmqSocketType.Pair); if (m_monitorSocket == null) { throw NetMQException.Create(ErrorCode.EFAULT); } // Never block context termination on pending event messages int linger = 0; try { m_monitorSocket.SetSocketOption(ZmqSocketOptions.Linger, linger); } catch (NetMQException) { StopMonitor(); throw; } // Spawn the monitor socket endpoint try { m_monitorSocket.Bind(addr); } catch (NetMQException) { StopMonitor(); throw; } }
public void Monitor([CanBeNull] string addr, SocketEvent events) { CheckContextTerminated(); // Support de-registering monitoring endpoints as well if (addr == null) { StopMonitor(); return; } string address; string protocol; DecodeAddress(addr, out address, out protocol); CheckProtocol(protocol); // Event notification only supported over inproc:// if (!protocol.Equals(Address.InProcProtocol)) { throw new ProtocolNotSupportedException(String.Format("In SocketBase.Monitor({0},), protocol must be inproc", addr)); } // Register events to monitor m_monitorEvents = events; m_monitorSocket = Ctx.CreateSocket(ZmqSocketType.Pair); if (m_monitorSocket == null) { throw new FaultException("In SocketBase.Monitor, Ctx.CreateSocket(ZmqSocketType.Pair) failed."); } // Never block context termination on pending event messages const int linger = 0; try { m_monitorSocket.SetSocketOption(ZmqSocketOptions.Linger, linger); } catch (NetMQException) { StopMonitor(); throw; } // Spawn the monitor socket endpoint try { m_monitorSocket.Bind(addr); } catch (NetMQException) { StopMonitor(); throw; } }
// Sockets public static SocketBase Socket(Ctx ctx, ZmqSocketType type) { if (ctx == null || !ctx.CheckTag()) { throw NetMQException.Create(ErrorCode.EFAULT); } SocketBase s = ctx.CreateSocket(type); return(s); }
// Sockets public static SocketBase Socket(Ctx ctx, ZmqSocketType type) { if (ctx == null || !ctx.CheckTag()) { throw NetMQException.Create(ErrorCode.EFAULT); } SocketBase s = ctx.CreateSocket(type); return s; }
// Sockets public static SocketBase Socket(Ctx ctx, ZmqSocketType type) { if (ctx == null || !ctx.CheckTag()) { throw new InvalidOperationException(); } SocketBase s = ctx.CreateSocket(type); return s; }