Exemple #1
0
            private bool SendStartTls()
            {
                IAsyncResult result = StartTlsCommand.BeginSend(_connection, SendStartTlsCallback, this);

                if (result.CompletedSynchronously)
                {
                    StartTlsCommand.EndSend(result);
                    TlsStreamAuthenticate();
                    return(true);
                }
                return(false);
            }
Exemple #2
0
 private static void SendStartTlsCallback(IAsyncResult result)
 {
     if (!result.CompletedSynchronously)
     {
         ConnectAndHandshakeAsyncResult thisPtr = (ConnectAndHandshakeAsyncResult)result.AsyncState;
         try
         {
             StartTlsCommand.EndSend(result);
             thisPtr.TlsStreamAuthenticate();
         }
         catch (Exception e)
         {
             thisPtr.InvokeCallback(e);
         }
     }
 }