示例#1
0
        /// <summary>
        ///     Initializes the base socket.
        /// </summary>
        /// <param name="socket">The underlying ZeroMQ socket.</param>
        /// <param name="heartbeatInterval">Heartbeat interval.</param>
        protected SocketBase(NetMQSocket socket, TimeSpan heartbeatInterval)
        {
            HeartbeatInterval = heartbeatInterval;
            Channels          = new Dictionary <object, Channel>();
            Closed            = false;
            Socket            = socket;
            TimerPoller       = new TimerPoller();

            Proactor = new NetMQProactor(socket, ReceiveMessage);
            TimerPoller.Start();
        }
示例#2
0
        /// <summary>
        ///     Initializes the base socket.
        /// </summary>
        /// <param name="socket">The underlying ZeroMQ socket.</param>
        /// <param name="heartbeatInterval">Heartbeat interval.</param>
        protected SocketBase(NetMQSocket socket, TimeSpan heartbeatInterval)
        {
            HeartbeatInterval = heartbeatInterval;

            Channels    = new Dictionary <object, Channel>(Config.MessageIdComparer);
            Closed      = false;
            Socket      = socket;
            TimerPoller = new TimerPoller();

            Poller = new NetMQPoller {
                Socket
            };
            Socket.ReceiveReady += ReceiveMessage;

            TimerPoller.Start();
            Poller.RunAsync();
        }