Пример #1
0
        private bool PacketReceiver()
        {
            if (!Connected)
            {
                return(false); // -- Terminate cycle
            }
            if (_stream.Available)
            {
                var packetId = _stream.ReadByte();

                // Connection lost
                if (packetId == 255)
                {
                    Disconnect();
                    return(false);
                }

                var length = ServerResponseClassic.ServerResponse[packetId]().Size;
                var data   = _stream.ReadByteArray(length - 1);

                HandlePacket(packetId, data);
            }

            return(true);
        }
Пример #2
0
        private bool PacketReceiver()
        {
            if (!Connected)
            {
                return(false); // -- Terminate cycle
            }
            if (_stream.Available)
            {
                var packetId = _stream.ReadByte();
                HandlePacket(packetId, _stream);
            }

            return(true);
        }