The sample is showing you how to do basic async socket programming, but it
is (as you point out) really defeating the purprose by doing so much
waiting.
Async sockets are good for handling lots of sockets very cheaply, and for
helping you not have to create and manage your own threads.
There are a number of better examples that Microsoft has put out. Their
server sample of that same program is a bit better: This creates a server
socket, that just echo's things back to the sender. Pretty straight forward.
http://msdn2.microsoft.com/en-us/library/fx6588te.aspx
There are a ton of examples on CodeProject that use async sockets:
http://www.google.com/search?hl=en&q...om&btnG=Search
--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins
"David" <no****@nospam.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
http://msdn2.microsoft.com/en-us/lib...2a(VS.80).aspx
I was looking at above link and I just don't see the advantage of this.
The main thread is just stopping and waiting for each of the
connects/sends/receives to complete anyway so it seems to me using the
synchronous methods would be much simpler and equivalent as far as
efficiency/performance in this example? What am I missing here? Is it just
that this example is simply to show the structure of putting the begin/end
asynch calls together and not demonstrating a practical use?
any input on this would be greatly appreciated. A good practical example
of asynchronous tcp client/server would be gold to me right now.