Hi everyone,
I've been working with the "new" (3.5, I think?) asynchronous socket API and have a question or two about it that I can't find answers to.
All of the *Async methods return a bool, which is false
if the operation completed synchronously. I'm a little confused as to how/why this could happen. It's not always an error condition, right? The MSDN examples immediately call the event handler manually in this case. Is that a good practice to follow?
Additionally, when I call Socket.SendAsync
for instance, and attach a handler to SocketAsyncEventArgs.Completed
, am I guaranteed that "Completed" is fired (or SendAsync
returns false
) only after all of my data has been sent? Or is it possible that it will call my handler somewhere in the middle?