What next?![Jetbyte Tools Socket Programs Jetbyte Tools Socket Programs](/uploads/1/2/5/8/125877080/167482751.png)
![Near Near](/uploads/1/2/5/8/125877080/871123934.jpg)
Powerbuilt tools and shop equipment offer quality, innovation, performance and value to demanding automotive enthusiasts and professionals. Learn more now!
The classes presented here provide an easy way to develop scalable socket servers using IO completion and thread pooling in such a way that the user of the classes need not concern themselves with these low level issues. To create your own server simply derive from CSocketServer to create your listening socket, handle connection establishment and any of the other notifications that you require. Then derive from the WorkerThread class to provide the byte stream chunking and business logic. Running your server is as simple as this:
![Jetbyte Tools Socket Programs Jetbyte Tools Socket Programs](/uploads/1/2/5/8/125877080/167482751.png)
Your code can then do whatever it likes and the socket server runs on its own threads. When you are finished, simply call:
And the socket server will shutdown.
In the next article we address the issue of moving the business logic out of the IO thread pool and into a thread pool of its own so that long operations don't block the IO threads.
DownloadThe source was built using Visual Studio 6.0 SP5 and Visual Studio .Net. You need to have a version of the Microsoft Platform SDK installed
All of the zip files mentioned can be found in the single zip file attached to this article.
- SocketServer1.zip - yet another echo server
- SocketServer2.zip - a packet based echo server
- SocketServer3.zip - a dummy POP3 server
- ServerShutdown.zip - an off switch for the servers
- 21st May 2002 - Initial revision posted on www.jetbyte.com.
- 27th May 2002 - Added pause/resume functionality to all servers and the server shutdown program. Use CSocket to protect from resource leaks when creating the listening socket. Refactored the Socket and CIOBuffer classes so that common list management code is now in CNodeList and common user data code is now in COpaqueUserData.
- 29th May 2002 - Linting and general code cleaning
- 18th June 2002 - Removed call to ReuseAddress() during the creation of the listening socket as it not required - Thanks to Alun Jones for pointing this out to me.
![Near Near](/uploads/1/2/5/8/125877080/871123934.jpg)
Thanks for reading the fine print. About the Wiki: We don't accept sponsorships, free goods, samples, promotional products, or other benefits from any of the product brands featured on this page, exceptin cases where those brands are manufactured by the retailer to which we are linking. For more information on our rankings, please read about us, linked below. The Wiki is a participant in associate programsfrom Amazon, Walmart, Ebay, Target, and others, and may earn advertising feeswhen you use our links to these websites. These fees will not increase your purchase price, which will be the same as any direct visitor to the merchant’s website.If you believe that your product should be includedin this review, you may contact us, but we cannot guarantee a response, even if you send us flowers. Ezvid Wiki is hiring: Are you a skilled researcher and writer based in the US, UK, or Canada, with deep knowledge of one or more of the categories that we cover, a keen eye for detail, excellent writing style, and the ability to follow complex and demanding editorial guidelines? If so, and if you'd like to get paid to write for Ezvid Wiki, please contact us to set up an interview.