SslStream.BeginSecureChannelInitiates an asynchronous request to the server to establish a secure channel.
public IAsyncResult BeginSecureChannel( AsyncCallback callback, object state ); public IAsyncResult BeginSecureChannel( string hostName, AsyncCallback callback, object state );
callback
(AsyncCallback)
An AsyncCallback delegate that references the method to invoke when the asynchronous operation is complete. Pass null to indicate that no callback is required.
state
(object)
An object that contains state information for this asynchronous operation. This parameter can be a null reference.
hostName
(string)
The host name of the server to authenticate.
IAsyncResult
An IAsyncResult object that contains information about the asynchronous operation.
Use the BeginSecureChannel method to begin establishing a secure channel over a connected stream. This method returns an IAsyncResult object, which you can use to track the progress of the asynchronous operation. When the operation is complete, the specified callback delegate is invoked.
You must call EndSecureChannel on the IAsyncResult object returned by this method to complete the operation and obtain the results. If you do not call EndSecureChannel, the stream will not be authenticated and security will not be enabled.
The hostName parameter is used for server authentication. If omitted, the server name is used from the context.
AuthenticateAsClient or AuthenticateAsServer methods.