diff options
Diffstat (limited to 'cppe/demo/IceE/callback/Server.cpp')
-rw-r--r-- | cppe/demo/IceE/callback/Server.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/cppe/demo/IceE/callback/Server.cpp b/cppe/demo/IceE/callback/Server.cpp new file mode 100644 index 00000000000..412adecbc20 --- /dev/null +++ b/cppe/demo/IceE/callback/Server.cpp @@ -0,0 +1,61 @@ +// ********************************************************************** +// +// 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 <IceE/IceE.h> +#include <CallbackI.h> + +using namespace std; +using namespace IceE; +using namespace Demo; + +int +run(int argc, char* argv[], const IceE::CommunicatorPtr& communicator) +{ + ObjectAdapterPtr adapter = communicator->createObjectAdapter("Callback.Server"); + adapter->add(new CallbackI, IceE::stringToIdentity("callback")); + adapter->activate(); + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ + int status; + IceE::CommunicatorPtr communicator; + + try + { + IceE::PropertiesPtr properties = IceE::createProperties(); + properties->load("config"); + communicator = IceE::initializeWithProperties(argc, argv, properties); + status = run(argc, argv, communicator); + } + catch(const IceE::Exception& ex) + { + fprintf(stderr, "%s\n", ex.toString().c_str()); + status = EXIT_FAILURE; + } + + if(communicator) + { + try + { + communicator->destroy(); + } + catch(const IceE::Exception& ex) + { + fprintf(stderr, "%s\n", ex.toString().c_str()); + status = EXIT_FAILURE; + } + } + + return status; +} + |