System.Net.Security.SslStream.EndAuthenticateAsClient C# (CSharp) Method

EndAuthenticateAsClient() public method

public EndAuthenticateAsClient ( IAsyncResult asyncResult ) : void
asyncResult IAsyncResult
return void
        public virtual void EndAuthenticateAsClient(IAsyncResult asyncResult)
        {
            _sslState.EndProcessAuthentication(asyncResult);
        }

Usage Example

Example #1
0
 // guarantees to close the socket on error
 public static void TlsConnect(Socket sock, string host, RemoteCertificateValidationCallback rcvc, Action<Exception,SslStream> cb)
 {
     SslStream ssl = null;
     try {
         ssl = new SslStream (new NetworkStream (sock, true), false, rcvc);
         ssl.BeginAuthenticateAsClient (host, (ar) => {
             try {
                 ssl.EndAuthenticateAsClient (ar);
             } catch (Exception ex) {
                 ssl.Dispose ();
                 sock.Dispose ();
                 cb (ex, null);
                 return;
             }
             cb (null, ssl);
         }, null);
     } catch (Exception ex) {
         if (ssl != null)
             ssl.Dispose ();
         sock.Dispose ();
         cb (ex, null);
     }
 }
All Usage Examples Of System.Net.Security.SslStream::EndAuthenticateAsClient