public async Task ReceiveAsyncLoop(ushort buffSize = 1472) { while (true) { using var mem = GetMemory(buffSize); var buf = mem.Memory.ToArray(); var rlt = await _socket.ReceiveMessageFromAsync(buf, SocketFlags.None, new IPEndPoint(IPAddress.Any, 0)); if (rlt.ReceivedBytes > 0) { rawReceive.Invoke(buf.AsSpan().Slice(0, rlt.ReceivedBytes), (IPEndPoint)rlt.RemoteEndPoint); } else { //Log...... } } }