public void WriteBuffer(byte[] buffer, int offset, int count)
    {
        if (ReceiveMessage.type.Equals(DataSendType.NONE))
        {
            if (buffer.Length == 0 || buffer.Length < 8)
            {
                return;
            }

            byte[] type   = new byte[4];
            byte[] length = new byte[4];

            Array.Copy(buffer, 0, type, 0, type.Length);
            Array.Copy(buffer, type.Length, length, 0, length.Length);

            ReceiveMessage.type       = (DataSendType)IPAddress.NetworkToHostOrder(BitConverter.ToInt32(type, 0));
            ReceiveMessage.dataLength = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(length, 0));


            //Debug.Log(ReceiveMessage.dataLength);
        }


        if (GetReserveCount() >= count) //缓存空间够用,不需要申请
        {
            Array.Copy(buffer, offset, Buffer, DataCount, count);
            DataCount = DataCount + count;
        }
        else //缓存区不够用,需要申请,并进行移位
        {
            int totalSize = Buffer.Length + count - GetReserveCount();

            byte[] tempBuffer = new byte[totalSize];
            Array.Copy(Buffer, 0, tempBuffer, 0, DataCount);
            Array.Copy(buffer, offset, tempBuffer, DataCount, count);

            DataCount = DataCount + count;
            Buffer    = tempBuffer;
        }

        if (DataCount >= ReceiveMessage.dataLength)
        {
            ReceiveMessage message = GetData();
            OnReceiveData(message);
            Clear(ReceiveMessage.dataLength);
            ReceiveMessage.Clear();
        }
    }