DemoServer.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "DemoServer.h"
  2. #include "DemoServantImp.h"
  3. using namespace std;
  4. DemoServer g_app;
  5. /////////////////////////////////////////////////////////////////
  6. void
  7. DemoServer::initialize()
  8. {
  9. //initialize application here:
  10. //...
  11. addServant<DemoServantImp>(ServerConfig::Application + "." + ServerConfig::ServerName + ".DemoServantObj");
  12. addServantProtocol(ServerConfig::Application + "." + ServerConfig::ServerName + ".DemoServantObj", &TC_NetWorkBuffer::parseHttp);
  13. }
  14. /////////////////////////////////////////////////////////////////
  15. void
  16. DemoServer::destroyApp()
  17. {
  18. //destroy application here:
  19. //...
  20. }
  21. /////////////////////////////////////////////////////////////////
  22. int
  23. main(int argc, char* argv[])
  24. {
  25. try
  26. {
  27. g_app.main(argc, argv);
  28. g_app.waitForShutdown();
  29. }
  30. catch (std::exception& e)
  31. {
  32. cerr << "std::exception:" << e.what() << std::endl;
  33. }
  34. catch (...)
  35. {
  36. cerr << "unknown exception." << std::endl;
  37. }
  38. return -1;
  39. }
  40. /////////////////////////////////////////////////////////////////