summaryrefslogtreecommitdiff
path: root/cpp/demo/Ice/invoke/Server.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2004-10-19 02:27:18 +0000
committerMark Spruiell <mes@zeroc.com>2004-10-19 02:27:18 +0000
commit4ee06da3e23c279897cef5b2b51487875b4486b7 (patch)
treee2080691778256ebf32ceabc7d8edce6e869fbad /cpp/demo/Ice/invoke/Server.cpp
parentupdating dependencies (diff)
downloadice-4ee06da3e23c279897cef5b2b51487875b4486b7.tar.bz2
ice-4ee06da3e23c279897cef5b2b51487875b4486b7.tar.xz
ice-4ee06da3e23c279897cef5b2b51487875b4486b7.zip
adding streaming API
Diffstat (limited to 'cpp/demo/Ice/invoke/Server.cpp')
-rw-r--r--cpp/demo/Ice/invoke/Server.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/cpp/demo/Ice/invoke/Server.cpp b/cpp/demo/Ice/invoke/Server.cpp
new file mode 100644
index 00000000000..5efaac91224
--- /dev/null
+++ b/cpp/demo/Ice/invoke/Server.cpp
@@ -0,0 +1,59 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2004 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 <PrinterI.h>
+
+using namespace std;
+
+int
+run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
+{
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Printer");
+ Ice::ObjectPtr object = new PrinterI;
+ adapter->add(object, Ice::stringToIdentity("printer"));
+ adapter->activate();
+ communicator->waitForShutdown();
+ 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;
+}