public AwaitableSocket ReceiveAsync()
        {
            _awaitableSocket.SetBuffer(_buffer);
            _position = 0;

            return(_awaitableSocket.ReceiveAsync());
        }
        public AwaitableSocket FlushAsync()
        {
            _awaitableSocket.SetBuffer(_buffer, 0, _position);
            _position = 0;

            return(_awaitableSocket.SendAsync());
        }
Ejemplo n.º 3
0
        public async Task FlushAsync()
        {
            _awaitableSocket.SetBuffer(_buffer, 0, _position);

            await _awaitableSocket.SendAsync();

            _position = 0;
        }
Ejemplo n.º 4
0
        public async Task FlushAsync()
        {
            if (_position == 0)
            {
                return;
            }

            _awaitableSocket.SetBuffer(_buffer, 0, _position);

            await _awaitableSocket.SendAsync();

            _position = 0;
        }
Ejemplo n.º 5
0
        public async Task ReceiveAsync()
        {
            _awaitableSocket.SetBuffer(_buffer, 0, _buffer.Length);

            await _awaitableSocket.ReceiveAsync();

            var bytesTransferred = _awaitableSocket.BytesTransferred;

            if (bytesTransferred == 0)
            {
                throw new EndOfStreamException();
            }

            _position = 0;
        }