コード例 #1
0
 private static void OnConnect(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         bool      flag      = false;
         Exception exception = null;
         SocketConnectionInitiator.ConnectAsyncResult asyncState = (SocketConnectionInitiator.ConnectAsyncResult)result.AsyncState;
         try
         {
             asyncState.socket.EndConnect(result);
             flag = true;
         }
         catch (SocketException exception2)
         {
             asyncState.TraceConnectFailure(exception2);
             asyncState.lastException = exception2;
             asyncState.currentIndex++;
             try
             {
                 flag = asyncState.StartConnect();
             }
             catch (Exception exception3)
             {
                 if (Fx.IsFatal(exception3))
                 {
                     throw;
                 }
                 flag      = true;
                 exception = exception3;
             }
         }
         if (flag)
         {
             asyncState.Complete(false, exception);
         }
     }
 }
コード例 #2
0
            private static void StartConnectCallback(object state)
            {
                SocketConnectionInitiator.ConnectAsyncResult result = (SocketConnectionInitiator.ConnectAsyncResult)state;
                bool      flag      = false;
                Exception exception = null;

                try
                {
                    flag = result.StartConnect();
                }
                catch (Exception exception2)
                {
                    if (Fx.IsFatal(exception2))
                    {
                        throw;
                    }
                    flag      = true;
                    exception = exception2;
                }
                if (flag)
                {
                    result.Complete(false, exception);
                }
            }