summaryrefslogtreecommitdiff
path: root/cpp/demo/Ice/session/Server.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-04-13 08:48:35 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-04-13 08:48:35 +0000
commitd4ed5d38a15c1ad0fdd93e7af23ecedaf5315f7c (patch)
treeb709522dc8c2bb51fb54574c9726a0533b6cb877 /cpp/demo/Ice/session/Server.cpp
parentFixed race condition in Thread_opVoid class. (diff)
downloadice-d4ed5d38a15c1ad0fdd93e7af23ecedaf5315f7c.tar.bz2
ice-d4ed5d38a15c1ad0fdd93e7af23ecedaf5315f7c.tar.xz
ice-d4ed5d38a15c1ad0fdd93e7af23ecedaf5315f7c.zip
added session demo.
Diffstat (limited to 'cpp/demo/Ice/session/Server.cpp')
-rw-r--r--cpp/demo/Ice/session/Server.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/cpp/demo/Ice/session/Server.cpp b/cpp/demo/Ice/session/Server.cpp
new file mode 100644
index 00000000000..156ce0a148f
--- /dev/null
+++ b/cpp/demo/Ice/session/Server.cpp
@@ -0,0 +1,62 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 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 <HelloSessionManagerI.h>
+
+using namespace std;
+using namespace Demo;
+
+int
+run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
+{
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("SessionManager");
+ SessionManagerIPtr manager = new HelloSessionManagerI;
+ Ice::ObjectPtr object = new HelloSessionManagerI;
+ adapter->add(object, Ice::stringToIdentity("SessionManager"));
+ adapter->activate();
+ communicator->waitForShutdown();
+ manager->destroy();
+ return EXIT_SUCCESS;
+}
+
+int
+main(int argc, char* argv[])
+{
+ int status;
+ Ice::CommunicatorPtr communicator;
+
+ try
+ {
+ Ice::PropertiesPtr properties = Ice::createProperties();
+ properties->load("config");
+ communicator = Ice::initializeWithProperties(argc, argv, properties);
+ status = run(argc, argv, communicator);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+
+ if(communicator)
+ {
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ cerr << ex << endl;
+ status = EXIT_FAILURE;
+ }
+ }
+
+ return status;
+}