Asynchronous I/O

As you’ve seen, you can add threading to any type of code by placing it into a separate method and creating a delegate. In addition, the .NET Framework also includes asynchronous support in many classes, particularly those that deal with streams (and hence the code you use for direct socket connections over a network, downloading Web pages, and writing or reading files). You can recognize these methods by their name. When asynchronous methods exist, they always take the same name as the synchronous method versions, with Begin or End added to the beginning.

For example, you can use the FileStream.BeginWrite method to start an asynchronous write operation. This can enable you to save a large amount of data to disk without waiting ...

Get Microsoft® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.