System.Net.Security.SslStream.BeginRead Method

Begins an asynchronous read operation that reads data from the stream and stores it in the specified array.

Syntax

public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)

Parameters

buffer
A byte array that receives the bytes read from the stream.
offset
The zero-based location in buffer at which to begin storing the data read from this stream.
count
The maximum number of bytes to read from the stream.
asyncCallback
An AsyncCallback delegate that references the method to invoke when the read operation is complete.
asyncState
A user-defined object that contains information about the read operation. This object is passed to the asyncCallback delegate when the operation completes.

Returns

An IAsyncResult object that indicates the status of the asynchronous operation.

Remarks

If encryption and or signing are enabled, the read operation reads the data from the underlying stream, checks the integrity of the data, and/or decrypts it. The asynchronous read operation must be completed by calling the SslStream.EndRead(IAsyncResult) method. Typically, the method is invoked by the asyncCallback delegate.

This method does not block while the operation completes. To block until the operation completes, use the SslStream.Read(Byte[], int, int) method.

For detailed information about using the asynchronous programming model, see Asynchronous Programming Overview

The System.Net.Security.SslStream class does not support multiple simultaneous read operations.

You cannot call this method until you have successfully authenticated. To authenticate call one of the erload:System.Net.Security.SslStream.AuthenticateAsClient, or erload:System.Net.Security.SslStream.BeginAuthenticateAsClient, erload:System.Net.Security.SslStream.AuthenticateAsServer, erload:System.Net.Security.SslStream.BeginAuthenticateAsServer methods.

Requirements

Namespace: System.Net.Security
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0