Exemplo n.º 1
0
        void ProcessMsg(NetSocket socket)
        {
            HeaderType header     = new HeaderType();
            ByteStream recvStream = new ByteStream(socket.GetRecvedPack(), socket.GetRecvedPackOffset(), socket.GetRecvedPackSize());
            int        headlen    = ReadStreamToHeader(header, recvStream, true);

            recvStream.ResetExtrenBuf(recvStream.GetBuf(), recvStream.GetCurtPos(), recvStream.GetNumberOfRichBytes());

            if (!IsSingleFrame(header))
            {
                if (isDecryptData)
                {
                    ByteStream decryptDataStream = new ByteStream();
                    Decrypt(header, recvStream, decryptDataStream);
                    decryptDataStream.SetCurt(0);
                    _ProcessMsg(GetMsgTypeValue(header), socket, header, decryptDataStream);
                }
                else
                {
                    _ProcessMsg(GetMsgTypeValue(header), socket, header, recvStream);
                }
            }
            else
            {
                _ProcessSingleFrame(socket, header, recvStream);
            }
        }