|
// webemMT.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include "../../cWebem.h"
/// An application class which reacts to a button press
class cButton
{
public:
char * Pressed()
{
printf("Button Pressed\n");
return "/pressed.html";
}
};
int _tmain(int argc, _TCHAR* argv[])
{
// Initialize application code
cButton button;
// Initialise web server.
http::server::cWebem theServer(
"0.0.0.0", // address
"1570", // port
".\\"); // document root
// register application method
// Whenever server sees <!--#webem hello -->
// call cHello::DisplayHTML() and include the HTML returned
theServer.RegisterActionCode( "name",
boost::bind(
&cButton::Pressed, // member function
&button ) ); // instance of class
// Tell user where to find the cWebem GUI
printf("%s",theServer.Splash().c_str());
// run the server
theServer.Run();
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.