title: Most suitable asynchronous socket model for an instant messenger client?
body: <p>I'm working on an instant messenger client in C++ (Win32) and I'm experimenting with different asynchronous socket models. So far I've been using <a href="http://msdn.microsoft.com/en-us/library/ms741540(VS.85).aspx" rel="nofollow noreferrer">WSAAsyncSelect</a> for receiving notifications via my main window. However, I've been experiencing some unexpected results with Winsock spawning additionally 5-6 threads (in addition to the initial thread created when calling WSAAsyncSelect) for one single socket.</p>
  
  <p>I have plans to revamp the client to support additional protocols via DLL:s, and I'm afraid that my current solution won't be suitable based on my experiences with WSAAsyncSelect in addition to me being negative towards mixing network with UI code (in the message loop).</p>
  
  <p>I'm looking for advice on what a suitable asynchronous socket model could be for a multi-protocol IM client which needs to be able to handle <strong>roughly 10-20+ connections</strong> (depending on amount of protocols and protocol design etc.), while not using an excessive amount of threads -- I am very interested in performance and keeping the resource usage down.</p>
  
  <p>I've been looking on IO Completion Ports, but from what I've gathered, it seems overkill. I'd very much appreciate some input on what a suitable socket solution could be!</p>
  
  <p>Thanks in advance! :-)</p>