コード例 #1
0
    /// <summary>
    /// 处理收到的数据
    /// </summary>
    private void ProcessReceive()
    {
        isProcessReceive = true;
        //解析数据包
        byte[] data = EncodeHelper.DecodePacket(ref dataCache);
        if (data == null)
        {
            isProcessReceive = false;
            return;
        }
        SocketMsg msg = EncodeHelper.DecodeMsg(data);

        //存储消息 等待处理
        socketMsgQueue.Enqueue(msg);
        //伪递归
        ProcessReceive();
    }