Ejemplo n.º 1
0
    private void CheckReceive()
    {
        while (true)
        {
            if (_socketCon.isSocketNull())
            {
                break;
            }

            //接收协议
            byte[] data    = null;
            int    datalen = 0;
            if (_socketCon.Rece(ref data, ref datalen))
            {
                MessageStruct message = MessageStruct.DeserializeData(data, datalen);

                sTime = message.serverTime;

                //分发协议
                if (OnReceivedPacket != null)
                {
                    OnReceivedPacket(message);
                }
            }

            Thread.Sleep(50);
        }
    }