From d4ed5d38a15c1ad0fdd93e7af23ecedaf5315f7c Mon Sep 17 00:00:00 2001 From: Matthew Newhook Date: Wed, 13 Apr 2005 08:48:35 +0000 Subject: added session demo. --- cpp/demo/Ice/session/Server.cpp | 62 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 cpp/demo/Ice/session/Server.cpp (limited to 'cpp/demo/Ice/session/Server.cpp') 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 +#include + +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; +} -- cgit v1.2.3