IntroductionThis article will explain how to integrate an embedded webserver with your Win32/C++ application, using the Lacewing networking library. It could be used for things like:Web administration - server applications often have a web interface, for remote administration - nothing but a web browser is required to administrate the server
Web applications - web applications written in C++ can be much faster and more scalable than PHP or ASP, with lower resource usage and nothing else to be installed
BackgroundI decided to write my own webserver class as an experiment over the Lacewing::SocketServer class, which uses multithreading and IO completion ports (the most scalable way to do sockets on Windows). Lacewing::Webserver soon became a powerful HTTP/1.1 implementation, featuring:HTTP GET/POST, with stream operators for the response (like cout)
Automatic GET/POST parameter parsing
File sending, internally using TransmitFile
Getting/setting cookies
Multipart file upload via POST
Getting/setting the last modified date, to easily implement caching
Full HTTPS support
And much more (the header file is well commented).
Installing the library Lacewing is compatible with any version of Visual C++ from VC6 and up. Applications developed using Lacewing will run on Windows 2000 and greater.The first thing you'll need to download and install the Lacewing library from here. Extract the ZIP, and put the contents of the C++ folder in a folder somewhere on your hard drive. The Lacewing.dll file will need to be distributed alongside your executable file, but you may put it in your Windows\System32 folder (or Windows\SysWOW64 on a 64 bit system) for development convenience if you want. Read more: Codeproject
Web applications - web applications written in C++ can be much faster and more scalable than PHP or ASP, with lower resource usage and nothing else to be installed
BackgroundI decided to write my own webserver class as an experiment over the Lacewing::SocketServer class, which uses multithreading and IO completion ports (the most scalable way to do sockets on Windows). Lacewing::Webserver soon became a powerful HTTP/1.1 implementation, featuring:HTTP GET/POST, with stream operators for the response (like cout)
Automatic GET/POST parameter parsing
File sending, internally using TransmitFile
Getting/setting cookies
Multipart file upload via POST
Getting/setting the last modified date, to easily implement caching
Full HTTPS support
And much more (the header file is well commented).
Installing the library Lacewing is compatible with any version of Visual C++ from VC6 and up. Applications developed using Lacewing will run on Windows 2000 and greater.The first thing you'll need to download and install the Lacewing library from here. Extract the ZIP, and put the contents of the C++ folder in a folder somewhere on your hard drive. The Lacewing.dll file will need to be distributed alongside your executable file, but you may put it in your Windows\System32 folder (or Windows\SysWOW64 on a 64 bit system) for development convenience if you want. Read more: Codeproject
0 comments:
Post a Comment