1 // **********************************************************************
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
8 // **********************************************************************
12 #include <Discovery.h>
18 class HelloI
: public Hello
23 sayHello(const Ice::Current
&)
25 cout
<< "Hello World!" << endl
;
29 class DiscoverI
: public Discover
33 DiscoverI(const Ice::ObjectPrx
& obj
) :
39 lookup(const DiscoverReplyPrx
& reply
, const Ice::Current
&)
45 catch(const Ice::LocalException
&)
53 const Ice::ObjectPrx _obj
;
56 class HelloServer
: public Ice::Application
60 virtual int run(int, char*[]);
64 main(int argc
, char* argv
[])
67 return app
.main(argc
, argv
, "config.server");
71 HelloServer::run(int argc
, char* argv
[])
73 Ice::StringSeq args
= Ice::argsToStringSeq(argc
, argv
);
74 args
= communicator()->getProperties()->parseCommandLineOptions("Discover", args
);
76 Ice::ObjectAdapterPtr adapter
= communicator()->createObjectAdapter("Hello");
77 Ice::ObjectAdapterPtr discoverAdapter
= communicator()->createObjectAdapter("Discover");
79 Ice::ObjectPrx hello
= adapter
->addWithUUID(new HelloI
);
80 DiscoverPtr d
= new DiscoverI(hello
);
81 discoverAdapter
->add(d
, communicator()->stringToIdentity("discover"));
83 discoverAdapter
->activate();
86 communicator()->waitForShutdown();