STL-based Web Server and Utility Classes | CodeGuru

STL-based Web Server and Utility Classes

The code for the web server was adapted from the httpsvr in MSDN. The visual interface has been removed. All of the the MFC code has been ripped out and converted to STL and socket classes were implemented. The socket classes are: Socket ServerSocket These feed handler classes: SocketHandler ServerSocketHandler HttpSocketHander Socket notification comes from […]

Written By
CodeGuru Staff
CodeGuru Staff
May 13, 2000
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

The code for the web server was adapted from the httpsvr in MSDN. The
visual interface has been removed. All of the the MFC code has been ripped out and
converted to STL and socket classes were implemented.

The socket classes are:

  • Socket
  • ServerSocket

These feed handler classes:

  • SocketHandler
  • ServerSocketHandler
  • HttpSocketHander

Socket notification comes from the abstract class SocketNotify
which SocketHandler implements. A ref can be passed in to
override the notification.

The http request classes are:

  • HttpBuffer
  • HttpRequest
  • HttpRquestProcess
  • HttpResponse

The request class allows you to create requests or to store a request. the request process processes
requests by passing in a pointer to a buffer. the request process class gets initial info like url and then
forms a response.

The startup code is in Server.cpp which delcares an instance of HttpServer. To set up
the code to run set the directory where your web pages are and then compile and run.

There are also several utility classes that can be used to replace mfc classes. They
support Files, Strings, Pipes, Events, Threads, Locks, Sockets and ServerSockets.
Only the class for strings is a drop in replacement. Sorry, but I dont have time to
manufacture the MFC interfaces, but if you want they are their for you to use.

I would like to here any comments on how to improve performance or how to better
implement the web server. So if you get time, please feel free to
email me.

Downloads

Download source – 143 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.