Esempio n. 1
0
        public static void Test()
        {
            Console.WriteLine("Testing Pyro flame server (make sure it's running on localhost 9999)...");
            Console.WriteLine("Pyrolite version: " + Config.PYROLITE_VERSION);

            setConfig();

            dynamic flame = new PyroProxy("localhost", 9999, "Pyro.Flame");

            Console.WriteLine("builtin:");
            using (dynamic r_max = (FlameBuiltin)flame.builtin("max"))
            {
                int maximum = (int)r_max(new int[] { 22, 99, 1 });              // invoke remote max() builtin function
                Console.WriteLine("maximum=" + maximum);
            }

            using (dynamic r_module = (FlameModule)flame.module("socket"))
            {
                String hostname = (String)r_module.gethostname();               // get remote hostname
                Console.WriteLine("hostname=" + hostname);
            }

            int sum = (int)flame.evaluate("9+9");

            Console.WriteLine("sum=" + sum);

            flame.execute("import sys; sys.stdout.write('HELLO FROM C#\\n')");

            using (FlameRemoteConsole console = (FlameRemoteConsole)flame.console())
            {
                console.interact();
            }
        }