All the I/O operations explained in the previous sections have been of the synchronous kind, meaning the caller is blocked until the data becomes available. Sometimes it’s more appropriate to read or write data asynchronously and get notified when the action has been completed. The Stream
class has intrinsic support for this modus operandi.
The essence of this feature is found in Begin
/End
method pairs, such as BeginRead
and EndRead
. Where Read
is a blocking operation waiting for data to be read and bubbled up to the application, the BeginRead
method immediately returns. However, it doesn’t have the requested data available right away. Instead, it will call you back after it has completed. To do so, a callback ...
No credit card required