Example #1
0
        public async Task SendMessage(byte[] buffer)
        {
            await Task.Yield();
            _sender = new SocketAwaitableEventWrapper(); // TODO fix this, its bad for performance.
            _sender.EventArgs.SetBuffer(buffer, 0, buffer.Length);

            await _socket.SendAsync(_sender.SocketAwaitable);
        }
Example #2
0
        public async Task SendMessage(byte[] buffer)
        {
            await Task.Yield();
            // TODO fix this, its bad for performance. Better than before, but we should probably use pooling.
            // The issue is that we dont know exactly how many allocations will be caused by X amount of players
            // making y amount of requests.
            using (SocketAwaitableEventWrapper sender = new SocketAwaitableEventWrapper())
            {
                sender.EventArgs.SetBuffer(buffer, 0, buffer.Length);

                await _socket.SendAsync(sender.SocketAwaitable);
            }
        }