summaryrefslogtreecommitdiff
path: root/cpp/demo/IceDiscovery/hello/Server.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2014-04-22 17:44:12 +0200
committerBenoit Foucher <benoit@zeroc.com>2014-04-22 17:44:12 +0200
commit873b482a66e5914ba3dcf85d17fdc94a62457c6a (patch)
tree18211a7e8f13d3f4322df9479025ce5f5a74d72c /cpp/demo/IceDiscovery/hello/Server.cpp
parentRemove Qt and VC90 settings from Makefiles. (diff)
downloadice-873b482a66e5914ba3dcf85d17fdc94a62457c6a.tar.bz2
ice-873b482a66e5914ba3dcf85d17fdc94a62457c6a.tar.xz
ice-873b482a66e5914ba3dcf85d17fdc94a62457c6a.zip
Added IceDiscovery service plugin
Diffstat (limited to 'cpp/demo/IceDiscovery/hello/Server.cpp')
-rw-r--r--cpp/demo/IceDiscovery/hello/Server.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/cpp/demo/IceDiscovery/hello/Server.cpp b/cpp/demo/IceDiscovery/hello/Server.cpp
new file mode 100644
index 00000000000..c68503b398d
--- /dev/null
+++ b/cpp/demo/IceDiscovery/hello/Server.cpp
@@ -0,0 +1,44 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <HelloI.h>
+
+using namespace std;
+
+class HelloServer : public Ice::Application
+{
+public:
+
+ virtual int run(int, char*[]);
+};
+
+int
+main(int argc, char* argv[])
+{
+ HelloServer app;
+ return app.main(argc, argv, "config.server");
+}
+
+int
+HelloServer::run(int argc, char*[])
+{
+ if(argc > 1)
+ {
+ cerr << appName() << ": too many arguments" << endl;
+ return EXIT_FAILURE;
+ }
+
+ Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Hello");
+ Demo::HelloPtr hello = new HelloI;
+ adapter->add(hello, communicator()->stringToIdentity("hello"));
+ adapter->activate();
+ communicator()->waitForShutdown();
+ return EXIT_SUCCESS;
+}