diff options
author | Marc Laukien <marc@zeroc.com> | 2001-09-15 08:13:54 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-09-15 08:13:54 +0000 |
commit | 4cada81a1bf05eb8ea49b09b53fc09deb843bc46 (patch) | |
tree | a2a4f20406a6c841cbc2bc3629c19842f4bc6702 /cpp/demo/Freeze/phonebook/Server.cpp | |
parent | missing .depend (diff) | |
download | ice-4cada81a1bf05eb8ea49b09b53fc09deb843bc46.tar.bz2 ice-4cada81a1bf05eb8ea49b09b53fc09deb843bc46.tar.xz ice-4cada81a1bf05eb8ea49b09b53fc09deb843bc46.zip |
started with phonebook demo
Diffstat (limited to 'cpp/demo/Freeze/phonebook/Server.cpp')
-rw-r--r-- | cpp/demo/Freeze/phonebook/Server.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/cpp/demo/Freeze/phonebook/Server.cpp b/cpp/demo/Freeze/phonebook/Server.cpp new file mode 100644 index 00000000000..cff1e1a6b00 --- /dev/null +++ b/cpp/demo/Freeze/phonebook/Server.cpp @@ -0,0 +1,59 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <PhoneBookI.h> + +using namespace std; + +int +run(int argc, char* argv[], Ice::CommunicatorPtr communicator) +{ + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("PhoneBookAdapter"); + Ice::ObjectPtr object = new PhoneBookI(adapter); + adapter->add(object, "phonebook"); + adapter->activate(); + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + Ice::CommunicatorPtr communicator; + + try + { + Ice::PropertiesPtr properties = Ice::createPropertiesFromFile(argc, argv, "config"); + communicator = Ice::initializeWithProperties(properties); + status = run(argc, argv, communicator); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + + if (communicator) + { + try + { + communicator->destroy(); + } + catch(const Ice::LocalException& ex) + { + cerr << ex << endl; + status = EXIT_FAILURE; + } + } + + return status; +} |