int Server::run(int argc, char* argv[]) { int ret; if ((ret = SPI_init())) return ret; shutdownOnInterrupt(); Ice::ObjectAdapterPtr adapter = communicator()-> createObjectAdapterWithEndpoints("Guitar", "default -p 10000"); guitarlib::ApplicationI *app = new guitarlib::ApplicationI(adapter); adapter->add(app, communicator()->stringToIdentity("Application")); adapter->activate(); communicator()->waitForShutdown(); ret = SPI_exit(); return ret; }
virtual int run(int argc, char* argv[]) { ClientOrServer::run(argc, argv); // Register a new object adapter Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("SonarEventListener.Subscriber"); // Subscribe to the event IceStorm::QoS qos; Ice::ObjectPrx subscriber = adapter->addWithUUID(new SonarEventPrinter); sonarTopic->subscribe(qos, subscriber); // Start the adapter and keep going until the program is killed adapter->activate(); shutdownOnInterrupt(); communicator()->waitForShutdown(); sonarTopic->unsubscribe(subscriber); return EXIT_SUCCESS; }