Beispiel #1
0
        public override int run(string[] args)
        {
            if (args.Length > 0)
            {
                System.Console.Error.WriteLine(appName() + ": too many arguments");
                return(1);
            }

            CallbackSenderPrx server = CallbackSenderPrxHelper.checkedCast(
                communicator().propertyToProxy("CallbackSender.Proxy"));

            if (server == null)
            {
                System.Console.Error.WriteLine("invalid proxy");
                return(1);
            }

            Ice.ObjectAdapter adapter = communicator().createObjectAdapter("");
            Ice.Identity      ident   = new Ice.Identity();
            ident.name     = Guid.NewGuid().ToString();
            ident.category = "";
            adapter.add(new CallbackReceiverI(), ident);
            adapter.activate();
            server.ice_getConnection().setAdapter(adapter);
            server.addClient(ident);
            communicator().waitForShutdown();

            return(0);
        }
Beispiel #2
0
        public static CallbackSenderPrx uncheckedCast(Ice.ObjectPrx b)
        {
            if (b == null)
            {
                return(null);
            }
            CallbackSenderPrx r = b as CallbackSenderPrx;

            if (r == null)
            {
                CallbackSenderPrxHelper h = new CallbackSenderPrxHelper();
                h.copyFrom__(b);
                r = h;
            }
            return(r);
        }
Beispiel #3
0
        public static CallbackSenderPrx checkedCast(Ice.ObjectPrx b, _System.Collections.Generic.Dictionary <string, string> ctx)
        {
            if (b == null)
            {
                return(null);
            }
            CallbackSenderPrx r = b as CallbackSenderPrx;

            if ((r == null) && b.ice_isA(ice_staticId(), ctx))
            {
                CallbackSenderPrxHelper h = new CallbackSenderPrxHelper();
                h.copyFrom__(b);
                r = h;
            }
            return(r);
        }
Beispiel #4
0
        public static CallbackSenderPrx checkedCast(Ice.ObjectPrx b)
        {
            if (b == null)
            {
                return(null);
            }
            CallbackSenderPrx r = b as CallbackSenderPrx;

            if ((r == null) && b.ice_isA(ice_staticId()))
            {
                CallbackSenderPrxHelper h = new CallbackSenderPrxHelper();
                h.iceCopyFrom(b);
                r = h;
            }
            return(r);
        }
Beispiel #5
0
    private static int Init()
    {
        int result = 0;

        try
        {
            Ice.Communicator communicator = Ice.Util.initialize("config.client");

            sender = CallbackSenderPrxHelper.checkedCast(communicator.propertyToProxy("CallbackSender.Proxy").
                                                         ice_twoway().ice_timeout(-1).ice_secure(false));
            if (sender == null)
            {
                Console.Error.WriteLine("invalid proxy");
                result = 0;
            }

            adapter = communicator.createObjectAdapter("Callback.Client");
            adapter.add(new CallbackReceiverI(), Ice.Util.stringToIdentity("callbackReceiver"));
            adapter.activate();

            receiver = CallbackReceiverPrxHelper.uncheckedCast(
                adapter.createProxy(Ice.Util.stringToIdentity("callbackReceiver")));

            Console.WriteLine("server connected");

            result = 1;
        }
        catch (Exception ex)
        {
            Console.Error.WriteLine(ex);

            Console.WriteLine("connection failed");
            result = 0;
        }

        return(result);
    }
Beispiel #6
0
 public static void write__(IceInternal.BasicStream os__, CallbackSenderPrx v__)
 {
     os__.writeProxy(v__);
 }
Beispiel #7
0
        public override int run(string[] args)
        {
            if (args.Length > 0)
            {
                Console.Error.WriteLine(appName() + ": too many arguments");
                return(1);
            }

            CallbackSenderPrx sender = CallbackSenderPrxHelper.checkedCast(
                communicator().propertyToProxy("CallbackSender.Proxy").
                ice_twoway().ice_timeout(-1).ice_secure(false));

            if (sender == null)
            {
                Console.Error.WriteLine("invalid proxy");
                return(1);
            }

            Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Callback.Client");
            adapter.add(new CallbackReceiverI(), communicator().stringToIdentity("callbackReceiver"));
            adapter.activate();

            CallbackReceiverPrx receiver = CallbackReceiverPrxHelper.uncheckedCast(
                adapter.createProxy(communicator().stringToIdentity("callbackReceiver")));

            menu();

            string line = null;

            do
            {
                try
                {
                    Console.Out.Write("==> ");
                    Console.Out.Flush();
                    line = Console.In.ReadLine();
                    if (line == null)
                    {
                        break;
                    }
                    if (line.Equals("t"))
                    {
                        sender.initiateCallback(receiver);
                    }
                    else if (line.Equals("s"))
                    {
                        sender.shutdown();
                    }
                    else if (line.Equals("x"))
                    {
                        // Nothing to do
                    }
                    else if (line.Equals("?"))
                    {
                        menu();
                    }
                    else
                    {
                        Console.Out.WriteLine("unknown command `" + line + "'");
                        menu();
                    }
                }
                catch (System.Exception ex)
                {
                    Console.Error.WriteLine(ex);
                }
            }while(!line.Equals("x"));

            return(0);
        }
Beispiel #8
0
 public static void write(Ice.OutputStream ostr, CallbackSenderPrx v)
 {
     ostr.writeProxy(v);
 }