An embeddable single-file C++ web server

Download from here! (13K)
License: zlib (permissive open source)
Example usage: smehtest.cpp (2KB)

Should work with almost any C++ compiler under Windows and Unix.
The primary purpose of this is to provide simple web-based interface
for C++ programs. The header file does not implement threading
functionality (although it allows for such functionality to be implemented)
so by default all operations are single-threaded and synchronous.

C++ Compatibility

    The ServerMe.H header file uses only BSD sockets and Winsock (depending on the compiler's predefined macros) and does not utilize the STL or namespaces, so it should compile with almost all C++ compilers for Windows and Unix/Linux. It has been tested under the following systems and compilers:

  • Borland C++ Builder 1 (Windows)
  • Borland C/C++ Compiler 5.5 Command Line Tools (Windows)
  • Digital Mars C++ 8.57 (Windows)
  • OpenWatcom 1.9 (Windows)
  • Visual Studio 2013 (Windows)
  • GCC (Windows, Linux and OpenBSD)

    The supplied smehtest.cpp file should compile under all these compilers and systems (except Digital Mars C++ 8.57 which out of the box does not have proper STL support - the smehtest.cpp example can be modified to not use STL and the program will compile cleanly). I also expect the program to compile under Mac OS X with Clang, but i cannot test that at the moment (i will update the page in the future after i have tested it).

    The Web Server program (shown below) requires Borland C++ Builder 1. It may work with some slightly newer versions, but it will probably need modifications to compile under a modern version of C++ Builder. I do not have access to this compiler to test it.


Example Program: Web Server

    This is a simple web server program for Windows that uses ServerMe.H to implement the web serving facilities. The program been written in Borland C++ Builder and should work with any version of Windows from Windows 95 to Windows 10 and later.

Download the Web Server sources and executable! (260K)

    The web server can function as a simple personal web server, although node that it is a single threaded program that cannot handle multiple simultaneous connections (it should not be a problem for very low loads, but anything above a few connections per minute will be too slow and a single long download can block the entire site).

    The program is tiny and can be installed in very old and slow computers without issue. It can run at the background and it closes ("minimizes") on the system tray so it can stay out if your way. In addition to serving static content, it can also serve limited dynamic content in the form of content DLLs (which are DLLs that provide the HTTP response). Check the contdll.txt file in the archive for details. A sample content DLL for a poll in C++ is included. Note that content DLLs are disabled by default and must be enabled via the options, otherwise the server will offer the DLL file itself for download.

    Here are some images:

the main window

the options dialog

the about dialog

the tray popup menu

Copyright 2015-2016 Kostas Michalopoulos