Пример #1
0
        void OnMessageCompleted(ArraySegment <byte> buffer)
        {
            if (Peer == null)
            {
                return;
            }

            Dispatcher.IncomingPacket(this, buffer);
        }
Пример #2
0
        public void OnConnected()
        {
            CurrentState  = STATE_CONNECTED;
            IsClosed      = 0;
            AutoHeartbeat = true;

            var msg = Packet.Create((short)NetworkDefine.SYS_NTF_CONNECTED);

            Dispatcher.IncomingPacket(true, this, new ArraySegment <byte>(msg.Buffer, 0, msg.Position));
        }
        public void OnConnected()
        {
            CurrentState = STATE_CONNECTED;
            IsClosed     = 0;

            var msg = new Packet(this, (UInt16)NetworkDefine.SYS_NTF_CONNECTED);

            Dispatcher.IncomingPacket(true, this, msg);

            if (ServerOpt.ClientHeartBeatIntervalSec > 0)
            {
                var heartBeatPkt = new Packet(this, (UInt16)NetworkDefine.SYS_START_HEARTBEAT);
                Dispatcher.IncomingPacket(true, this, heartBeatPkt);
            }
        }