int main(const std::vector<std::string>& args) { if (_helpRequested) { displayHelp(); } else { // get parameters from configuration file unsigned short port = (unsigned short) config().getInt("EchoServer.port", 9977); // set-up a server socket ServerSocket svs(port); // set-up a SocketReactor... SocketReactor reactor; // ... and a SocketAcceptor SocketAcceptor<EchoServiceHandler> acceptor(svs, reactor); // run the reactor in its own thread so that we can wait for // a termination request Thread thread; thread.start(reactor); // wait for CTRL-C or kill waitForTerminationRequest(); // Stop the SocketReactor reactor.stop(); thread.join(); } return Application::EXIT_OK; }