Exemplo n.º 1
0
        public override int run(string[] args)
        {
            var adapter = communicator().createObjectAdapter("DiscoverReply");
            var replyI  = new DiscoverReplyI();
            var reply   = DiscoverReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI));

            adapter.activate();

            var discover = DiscoverPrxHelper.uncheckedCast(
                communicator().propertyToProxy("Discover.Proxy").ice_datagram());

            discover.lookup(reply);
            var obj = replyI.waitReply(2000);

            if (obj == null)
            {
                Console.Error.WriteLine(appName() + ": no replies");
                return(1);
            }
            var hello = HelloPrxHelper.checkedCast(obj);

            if (hello == null)
            {
                Console.Error.WriteLine(appName() + ": invalid reply");
                return(1);
            }

            hello.sayHello();
            return(0);
        }
Exemplo n.º 2
0
        public override int run(string[] args)
        {
            args = communicator().getProperties().parseCommandLineOptions("Discover", args);

            Ice.ObjectAdapter adapter = communicator().createObjectAdapter("DiscoverReply");
            DiscoverReplyI    replyI  = new DiscoverReplyI();
            DiscoverReplyPrx  reply   = DiscoverReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI));

            adapter.activate();

            DiscoverPrx discover = DiscoverPrxHelper.uncheckedCast(
                communicator().propertyToProxy("Discover.Proxy").ice_datagram());

            discover.lookup(reply);
            Ice.ObjectPrx obj = replyI.waitReply(2000);


            if (obj == null)
            {
                System.Console.Error.WriteLine(appName() + ": no replies");
                return(1);
            }
            HelloPrx hello = HelloPrxHelper.checkedCast(obj);

            if (hello == null)
            {
                System.Console.Error.WriteLine(appName() + ": invalid reply");
                return(1);
            }

            hello.sayHello();
            return(0);
        }