#include #include #include #include #include #include #include "logging.h" using namespace org::hebe::mps::naming; class LogServerImpl: public Logging::LogServer { private: int index; public: LogServerImpl() : index(1) {} virtual bool logString(std::string const &str) { printf("%d: %s\n", index++, str.c_str()); return true; } }; int main(int argc, char *argv[]) { try { MPS::InetTransport::initialise("", 0); Logging::LogServerServer server("Logserver", new LogServerImpl()); ref ns = MPS::getNamingService(); ns->bind(server.getObjectName(), MPS::Transport::bindServer(&server, "mps:inet"), true); MPS::InetTransport::getFdMgr()->mainloop(); // once per process } catch (MPS::MPSException e) { fprintf(stderr, "Exception: %s\n", e.getMessage().c_str()); return 1; } return 0; }