Begins an asynchronous read operation that reads data from the stream and stores it in the specified array.
Assembly: System (in System.dll)
[<HostProtectionAttribute(SecurityAction.LinkDemand, ExternalThreading = true)>] abstract BeginRead : buffer:byte * offset:int * count:int * asyncCallback:AsyncCallback * asyncState:Object -> IAsyncResult [<HostProtectionAttribute(SecurityAction.LinkDemand, ExternalThreading = true)>] override BeginRead : buffer:byte * offset:int * count:int * asyncCallback:AsyncCallback * asyncState:Object -> IAsyncResult
- Type: System.Int32
The zero-based location in buffer at which to begin storing the data read from this stream.
- Type: System.Int32
The maximum number of bytes to read from the stream.
- Type: System.AsyncCallback
An AsyncCallback delegate that references the method to invoke when the read operation is complete.
- Type: System.Object
A user-defined object that contains information about the read operation. This object is passed to the asyncCallback delegate when the operation completes.
buffer is a null reference (Nothing in Visual Basic).
offset < 0.
offset > the length of buffer.
offset + count > the length of buffer.
The read operation failed.
Encryption is in use, but the data could not be decrypted.
There is already a read operation in progress.
This object has been closed.
Authentication has not occurred.
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 EndRead 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 Read method.
For detailed information about using the asynchronous programming model, see Calling Synchronous Methods Asynchronously
The 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 AuthenticateAsClient, or BeginAuthenticateAsClient, AuthenticateAsServer, BeginAuthenticateAsServer methods.
The HostProtectionAttribute attribute applied to this type or member has the following Resources property value: ExternalThreading. The HostProtectionAttribute does not affect desktop applications (which are typically started by double-clicking an icon, typing a command, or entering a URL in a browser). For more information, see the HostProtectionAttribute class or SQL Server Programming and Host Protection Attributes.
The following code example demonstrates starting an asynchronous read operation.
The following method is called when the read completes.