示例#1
0
        /// <summary>
        /// Listen to the given endpoint for SocketEvent events.
        /// </summary>
        /// <param name="endpoint">A string denoting the endpoint to monitor</param>
        /// <param name="events">The specific <see cref="SocketEvents"/> events to report on. Defaults to <see cref="SocketEvents.All"/> if omitted.</param>
        /// <exception cref="ArgumentNullException"><paramref name="endpoint"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException"><paramref name="endpoint"/> cannot be empty or whitespace.</exception>
        /// <exception cref="ObjectDisposedException">This object is already disposed.</exception>
        /// <exception cref="ProtocolNotSupportedException">The protocol of <paramref name="endpoint"/> is not supported.</exception>
        /// <exception cref="TerminatingException">The socket has been stopped.</exception>
        /// <exception cref="NetMQException">Maximum number of sockets reached.</exception>
        public void Monitor([NotNull] string endpoint, SocketEvents events = SocketEvents.All)
        {
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }
            if (string.IsNullOrEmpty(endpoint))
            {
                throw new ArgumentException("Cannot be empty.", nameof(endpoint));
            }

            m_socketHandle.CheckDisposed();

            m_socketHandle.Monitor(endpoint, events);
        }
示例#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");
            }

            m_socketHandle.CheckDisposed();

            m_socketHandle.Monitor(endpoint, events);
        }