I found an example for async ftp upload on msdn which does the following (snippet):
// Asynchronously get the stream for the file contents.
request.BeginGetRequestStream(
new AsyncCallback (EndGetStreamCallback),
state
);
// Block the current thread until all operations are complete.
waitObject.WaitOne();
The thing what I do not understand here is, which sense does asynchronous IO make if the thread is blocked anyway with an explicit waithandle. I always thought the advantage of asynchronous IO was that the user/programm does not have to wait.
It’s just an example.
In a Real World Application (TM) your code could be running the GUI thread. And we all know that blocking the GUI thread is killer when it comes to user experience.
When the async operation finished, it would call some sort of a notifier in your GUI, which allows the user to do other stuff while waiting for the transfer to finish.