ICE 3.4.2
[php5-ice-freebsdport.git] / cpp / test / Ice / proxy / Server.cpp
blob2aae00c58373ba49106e370e8f179971b550b1e0
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 <TestI.h>
13 using namespace std;
15 int
16 run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
18 communicator->getProperties()->setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
19 Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter");
20 adapter->add(new MyDerivedClassI, communicator->stringToIdentity("test"));
21 adapter->activate();
23 communicator->waitForShutdown();
24 return EXIT_SUCCESS;
27 int
28 main(int argc, char* argv[])
30 int status;
31 Ice::CommunicatorPtr communicator;
33 try
35 Ice::InitializationData initData;
36 initData.properties = Ice::createProperties(argc, argv);
37 communicator = Ice::initialize(argc, argv, initData);
38 status = run(argc, argv, communicator);
40 catch(const Ice::Exception& ex)
42 cerr << ex << endl;
43 status = EXIT_FAILURE;
46 if(communicator)
48 try
50 communicator->destroy();
52 catch(const Ice::Exception& ex)
54 cerr << ex << endl;
55 status = EXIT_FAILURE;
59 return status;