BeginReceive() public method

public BeginReceive ( ) : RioBufferSegment
return RioBufferSegment
コード例 #1
0
        public void Start()
        {
            _socket.BeginReceive(_nextInputSegment);

            if (_nextInputSegment.IsCompleted)
            {
                CompleteRead();
            }
            else
            {
                _nextInputSegment.OnCompleted(completeReadDelegate);
            }
        }
コード例 #2
0
        public void Start()
        {
            _nextInputSegment    = _nextInputSegment ?? _socket.ReceiveBufferPool.GetBuffer();
            _currentInputSegment = _currentInputSegment ?? _socket.ReceiveBufferPool.GetBuffer();
            _socket.BeginReceive(_nextInputSegment);

            if (_nextInputSegment.IsCompleted)
            {
                CompleteRead();
            }
            else
            {
                _nextInputSegment.OnCompleted(completeReadDelegate);
            }
        }
コード例 #3
0
        private void GetNewSegment()
        {
            _currentInputSegment = _incommingSegments.GetResult();
            if (_currentInputSegment == null)
            {
                _readtcs.SetResult(0);
                return;
            }

            _bytesReadInCurrentSegment = 0;
            _currentContentLength      = _currentInputSegment.CurrentContentLength;

            if (_currentContentLength == 0)
            {
                _currentInputSegment.Dispose();
                _currentInputSegment = null;
                _readtcs.SetResult(0);
                return;
            }
            else
            {
                _socket.BeginReceive();
                CompleteRead();
            }
        }
コード例 #4
0
ファイル: RioStream.cs プロジェクト: cube3power/Cowboy
 public RioStream(RioSocket socket)
 {
     _socket = socket;
     _currentInputSegment = null;
     _currentOutputSegment = _socket.SendBufferPool.GetBuffer();
     _getNewSegmentDelegate = GetNewSegment;
     socket.OnIncommingSegmentUnsafe = (sock, s) => _incommingSegments.Set(s);
     socket.BeginReceive();
 }
コード例 #5
0
 public RioStream(RioSocket socket)
 {
     _socket = socket;
     _currentInputSegment            = null;
     _currentOutputSegment           = _socket.SendBufferPool.GetBuffer();
     _getNewSegmentDelegate          = GetNewSegment;
     socket.OnIncommingSegmentUnsafe = (sock, s) => _incommingSegments.Set(s);
     socket.BeginReceive();
 }
コード例 #6
0
ファイル: RioStream.cs プロジェクト: xela-trawets/RioSharp
 public RioStream(RioSocket socket)
 {
     _socket = socket;
     _currentInputSegment           = _socket.ReceiveBufferPool.GetBuffer();
     _currentOutputSegment          = _socket.SendBufferPool.GetBuffer();
     _nextInputSegment              = _socket.ReceiveBufferPool.GetBuffer();
     _getNewSegmentDelegateDelegate = GetNewSegmentDelegateWrapper;
     _outputSegmentTotalLength      = _currentOutputSegment.TotalLength;
     _remainingSpaceInOutputSegment = _outputSegmentTotalLength;
     _socket.BeginReceive(_nextInputSegment);
     _waitCallback = WaitCallbackcallback;
 }
コード例 #7
0
ファイル: RioStream.cs プロジェクト: xela-trawets/RioSharp
 int GetNewSegment()
 {
     if (_nextInputSegment.CurrentContentLength == 0)
     {
         _nextInputSegment.Dispose();
         _currentInputSegment.Dispose();
         return(0);
     }
     else
     {
         _bytesReadInCurrentSegment = 0;
         _nextInputSegment          = _socket.BeginReceive(Interlocked.Exchange(ref _currentInputSegment, _nextInputSegment));
         return(CompleteRead());
     }
 }
コード例 #8
0
ファイル: FlippingRioStream.cs プロジェクト: aL3891/RioSharp
        public FlippingRioStream(RioSocket socket)
        {
            _socket = socket;
            _currentInputSegment = _socket.ReceiveBufferPool.GetBuffer();
            _currentOutputSegment = _socket.SendBufferPool.GetBuffer();
            _nextInputSegment = _socket.ReceiveBufferPool.GetBuffer();

            if (_nextInputSegment._awaitableState != RioBufferSegment._notStarted)
            {

            }

            _getNewSegmentDelegateDelegate = GetNewSegmentDelegateWrapper;

            _outputSegmentTotalLength = _currentOutputSegment.TotalLength;
            _remainingSpaceInOutputSegment = _outputSegmentTotalLength;
            _socket.BeginReceive(_nextInputSegment);

            _waitCallback = WaitCallbackcallback;
        }
コード例 #9
0
ファイル: RioStream.cs プロジェクト: cube3power/RioSharp
        private int GetNewSegment()
        {
            var tmp = _currentInputSegment;
            _nextInputSegment.GetResult();
            _currentInputSegment = _nextInputSegment;

            _bytesReadInCurrentSegment = 0;
            _currentContentLength = _currentInputSegment.CurrentContentLength;

            if (_currentContentLength == 0)
            {
                _currentInputSegment.Dispose();
                tmp.Dispose();
                return 0;
            }
            else
            {
                _nextInputSegment = tmp;
                _socket.BeginReceive(_nextInputSegment);
                return CompleteRead();
            }
        }