Method EndRead
EndRead(IAsyncResult)
Waits for the pending asynchronous read to complete. (Consider using ReadAsync(byte[], int, int) instead.)
public override int EndRead(IAsyncResult asyncResult)
Parameters
asyncResult
IAsyncResultThe reference to the pending asynchronous request to finish.
Returns
- int
The number of bytes read from the stream, between zero (0) and the number of bytes you requested. Streams return zero (0) only at the end of the stream, otherwise, they should block until at least one byte is available.
Exceptions
- ArgumentNullException
asyncResult
is null.- ArgumentException
A handle to the pending read operation is not available.
-or-
The pending operation does not support reading.- InvalidOperationException
asyncResult
did not originate from a BeginRead(byte[], int, int, AsyncCallback, object) method on the current stream.- IOException
The stream is closed or an internal error has occurred.