Cancel() public method

public Cancel ( ) : void
return void
コード例 #1
0
 internal void CancelConnectAsync()
 {
     if (_operating == InProgress && _completedOperation == SocketAsyncOperation.Connect)
     {
         if (_multipleConnect != null)
         {
             // If a multiple connect is in progress, abort it.
             _multipleConnect.Cancel();
         }
         else
         {
             // Otherwise we're doing a normal ConnectAsync - cancel it by closing the socket.
             // _currentSocket will only be null if _multipleConnect was set, so we don't have to check.
             if (_currentSocket == null)
             {
                 if (GlobalLog.IsEnabled)
                 {
                     GlobalLog.Assert("SocketAsyncEventArgs::CancelConnectAsync - CurrentSocket and MultipleConnect both null!");
                 }
                 Debug.Fail("SocketAsyncEventArgs::CancelConnectAsync - CurrentSocket and MultipleConnect both null!");
             }
             _currentSocket.Dispose();
         }
     }
 }