Async vs Sync - Socket Programming

Jul 17 2009 12:17 PM
Howdy!

I am trying to get my head around socket programming using the System.Net.Sockets namespace.. I have been reading and reading on the two methods of creating a TCPClient/TCPServer utilizing the TcpClient,TcpListener or using the Sockets Async methods/objects.

After reading I have become really confused on why you would ever want to use the synchronous method.  using synchronous method, you are putting your sockets in a blocking state that locks up the process control and doesn't allow you to do any other processing correct?

With Asynchronous, you create ASyncCallBack methods that pass process control back to the OS until the network functions are complete and then says 'HEY i'm done, give me control back!'.

If I am understand this correctly, what situation would you want to use Synchronous?  I am just looking for some clarification..  any input or corrections in my thinking is REALLY appreciate.. Trying to get into .NET networking programming and has been confusing me.

Thanks for any input!

Jordan