System.Net.Sockets.SocketAsyncEventArgs.FinishOperationAsyncFailure C# (CSharp) Method

FinishOperationAsyncFailure() private method

private FinishOperationAsyncFailure ( Exception exception, int bytesTransferred, SocketFlags flags ) : void
exception Exception
bytesTransferred int
flags SocketFlags
return void
        internal void FinishOperationAsyncFailure(Exception exception, int bytesTransferred, SocketFlags flags)
        {
            SetResults(exception, bytesTransferred, flags);

            if (_currentSocket != null)
            {
                _currentSocket.UpdateStatusAfterSocketError(_socketError);
            }

            Complete();
            if (_context == null)
            {
                OnCompleted(this);
            }
            else
            {
                ExecutionContext.Run(_context, s_executionCallback, this);
            }
        }

Same methods

SocketAsyncEventArgs::FinishOperationAsyncFailure ( SocketError socketError, int bytesTransferred, SocketFlags flags ) : void

Usage Example

        private void AsyncFail(Exception e)
        {
            OnFail(false);
            if (internalArgs != null)
            {
                internalArgs.Dispose();
            }

            userArgs.FinishOperationAsyncFailure(e, 0, SocketFlags.None);
        }
SocketAsyncEventArgs