示例#1
0
 protected override void HandleUnknownRequest(ProtocolRequestBase requestInfo)
 {
     try
     {
         //解析并派发
         ProtocolAnalysisService.AnalysisAndDispatchMessage(this, requestInfo);
     }
     catch (Exception e)
     {
         Debug.LogError("AnalysisAndDispatchMessage :" + requestInfo.Key + "\nException: " + e.ToString());
     }
 }
示例#2
0
    void process_recv_queue()
    {
        mRecvQueue.Switch();

        while (!mRecvQueue.Empty())
        {
            var buf = mRecvQueue.Pop();

            mKcp.Input(buf);
            mNeedUpdateFlag = true;

            for (var size = mKcp.PeekSize(); size > 0; size = mKcp.PeekSize())
            {
                var buffer = new byte[size];
                if (mKcp.Recv(buffer) > 0)
                {
                    //evHandler(buffer);
                    //这里开始解包

                    try
                    {
                        //解析并派发
                        ByteArray ba = new ByteArray();
                        ba.WriteALLBytes(buffer);
                        ProtocolRequestBase msg = Analysis(ba);

                        ProtocolAnalysisService.AnalysisAndDispatchMessage(this, msg);
                    }
                    catch (Exception e)
                    {
                        Debug.LogError("AnalysisAndDispatchMessage :\nException: " + e.ToString());
                    }
                }
            }
        }
    }
示例#3
0
 protected override void HandleUnknownRequest(ProtocolRequestBase requestInfo)
 {
     //解析并派发
     ProtocolAnalysisService.AnalysisAndDispatchMessage(this, requestInfo);
 }