Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

Stream.EndRead Method

Waits for the pending asynchronous read to complete.

[Visual Basic]
Public Overridable Function EndRead( _
   ByVal asyncResult As IAsyncResult _
) As Integer
[C#]
public virtual int EndRead(
 IAsyncResult asyncResult
);
[C++]
public: virtual int EndRead(
 IAsyncResult* asyncResult
);
[JScript]
public function EndRead(
   asyncResult : IAsyncResult
) : int;

Parameters

asyncResult
The reference to the pending asynchronous request to finish.

Return Value

The number of bytes read from the stream, between zero (0) and the number of bytes you requested. Streams only return zero (0) at the end of the stream, otherwise, they should block until at least one byte is available.

Exceptions

Exception Type Condition
ArgumentNullException asyncResult is a null reference (Nothing in Visual Basic).
ArgumentException asyncResult did not originate from a BeginRead method on the current stream.

Remarks

For an example of creating a file and writing text to a file, see Writing Text to a File. For an example of reading text from a file, see Reading Text from a File. For an example of reading from and writing to a binary file, see Reading and Writing to a Newly Created Data File. For an example of asynchronous file I/O, see Asynchronous File I/O.

Call EndRead to determine how many bytes were read from the stream.

EndRead can be called once on every IAsyncResult from BeginRead.

This method blocks until the I/O operation has completed.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Stream Class | Stream Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File | Asynchronous File I/O

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.