public bool PushMsg(ref Msg msg)
        {
            Debug.Assert(m_options.SocketType == ZmqSocketType.Pub || m_options.SocketType == ZmqSocketType.Xpub);

            // The first message is identity.
            // Let the session process it.

            m_session.PushMsg(ref msg);

            // Inject the subscription message so that the ZMQ 2.x peer
            // receives our messages.
            msg.InitPool(1);
            msg.Put((byte)1);

            bool isMessagePushed = m_session.PushMsg(ref msg);

            m_session.Flush();

            // Once we have injected the subscription message, we can
            // Divert the message flow back to the session.
            Debug.Assert(m_decoder != null);
            m_decoder.SetMsgSink(m_session);

            return(isMessagePushed);
        }
Beispiel #2
0
        void IEngine.Plug(IOThread ioThread, SessionBase session)
        {
            m_session = session;
            m_ioObject = new IOObject(null);
            m_ioObject.SetHandler(this);
            m_ioObject.Plug(ioThread);
            m_ioObject.AddSocket(m_handle);

            DropSubscriptions();

            var msg = new Msg();
            msg.InitEmpty();

            // push message to the session because there is no identity message with pgm
            session.PushMsg(ref msg);

            m_state = State.Receiving;
            BeginReceive();
        }
Beispiel #3
0
        void IEngine.Plug(IOThread ioThread, SessionBase session)
        {
            this.m_session  = session;
            this.m_ioObject = new IOObject(null);
            this.m_ioObject.SetHandler(this);
            this.m_ioObject.Plug(ioThread);
            this.m_ioObject.AddSocket(this.m_handle);

            this.DropSubscriptions();

            Msg msg = new Msg();

            msg.InitEmpty();

            // push message to the session because there is no identity message with pgm
            session.PushMsg(ref msg);

            this.m_state = State.Receiving;
            this.BeginReceive();
        }