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 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.


Download source – 143 Kb

More by Author

Must Read