示例#1
0
        public void Receive()
        {
            //while (true)
            //{
            IncomingPacket incomingPacket;

            while (incomingPackets.TryDequeue(out incomingPacket))
            {
                PacketUtil.HandleGroup(
                    incomingPacket.data,
                    incomingPacket.length,

                    (byte[] _data, int _len) => {
                    OnReceived(_data, _len);
                }
                    );
            }
            //}
        }
示例#2
0
        public void Receive()
        {
            //while (true)
            //{
            IncomingPacket incomingPacket;

            while (incomingPackets.TryDequeue(out incomingPacket))
            {
                PacketUtil.HandleGroup(
                    incomingPacket.data,
                    incomingPacket.length,

                    (byte[] _data, int _len) => {
                    OnReceived(clients[incomingPacket.peerID], _data, _len);
                }
                    );

                receiveBufferPool.Return(incomingPacket.data);
            }
            //}
        }