<p>Are there any templates/patterns/guides I can follow for designing a multithreaded server?  I can't find anything terribly useful online through my google searches.</p>

<p>My program will start a thread to listen for connections using TcpListener.
Every client connection will be handled by it's own IClientHandler thread.  The server will wrap the clientHandler.HandleClient in a delegate, call BeginInvoke, and then quit caring about it.</p>

<p>I also need to be able to cleanly shutdown the listening thread, which is something I'm not finding a lot of exampes of online.</p>

<p>I'm assuming some mix of lock/AutoResetEvents/threading magic combined with the async BeginAceptTcpClient and EndAcceptTcpClient will get me there, but when it comes to networking code, to me it's all been done. So I have to believe there's just some pattern out there I can follow and not get totally confused by the myriad multithreaded corner cases I can never seem to get perfect.</p>

<p>Thanks.</p>

Oddly enough you may find something on a Computer Science Assignment,
CSC 512 Programming Assignment 4: Multi-Threaded Server With Patterns
. Altough it's C++ voodoo but the theory is quite understandable for someone who can do C#.
Acceptor/ Connector
Monitor Object
Thread Safe Interface
Wrapper Facade
Scoped Locking
Strategized Locking
Reactor
Half Sync/Half-Async
Leaders/Followers
Altough you can get the whole list of nice readings on the
main page
.