Quote Originally Posted by EmbeddedC View Post
The clue is, I want to use it in a GUI application. Using async BeginRead/EndRead still makes it not friendly as a class for a GUI. Because I have to call Mainthread.InvokeRequired to post the mainthread a message that some data has been received. While using backgroundworker class, we don't have that problem and the class much better to use for other programmers.
Yes and no.

The 'yes' part:
BackgroundWorker *slightly* simplifies how async operations can be safely used in a winforms application. All it does is call Mainthread.Invoke () for you when you raise the ProgressChanged and RunWorkerComplete events so that these events end up on the main loop. That's the only 'magic' it has.

The 'no' part:
You most definitely do *not* want to use 1 thread per socket in an application which makes heavy use of sockets. If you're only making a few connections (~5) then it's fine. If you're making 300 connections, it'd be horrible

In either case, you can still use the async methods. There's no issue with using them as part of your background worker. Things will be pretty much exactly the same as what you have now, except that you'll be using BeginRead and EndRead instead of just "Read". If you're using the background worker correctly, things will work just fine.