ICE 3.4.2
[php5-ice-freebsdport.git] / cpp / demo / Ice / hello / Server.cpp
blob54af556237505e950d96851094ea8eff6c007287
1 // **********************************************************************
2 //
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
4 //
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
7 //
8 // **********************************************************************
10 #include <Ice/Ice.h>
11 #include <HelloI.h>
13 using namespace std;
15 class HelloServer : public Ice::Application
17 public:
19 virtual int run(int, char*[]);
22 int
23 main(int argc, char* argv[])
25 HelloServer app;
26 return app.main(argc, argv, "config.server");
29 int
30 HelloServer::run(int argc, char* argv[])
32 if(argc > 1)
34 cerr << appName() << ": too many arguments" << endl;
35 return EXIT_FAILURE;
38 Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("Hello");
39 Demo::HelloPtr hello = new HelloI;
40 adapter->add(hello, communicator()->stringToIdentity("hello"));
41 adapter->activate();
42 communicator()->waitForShutdown();
43 return EXIT_SUCCESS;