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

            var adapter = communicator().createObjectAdapter("Hello");
            var hello = new HelloI(communicator().getProperties().getProperty("Ice.ProgramName"));
            adapter.add(hello, Ice.Util.stringToIdentity("hello"));
            adapter.activate();
            communicator().waitForShutdown();
            return 0;
        }
예제 #2
0
        public override int run(string[] args)
        {
            if (args.Length > 0)
            {
                System.Console.Error.WriteLine(appName() + ": too many arguments");
                return(1);
            }

            var adapter = communicator().createObjectAdapter("Hello");
            var hello   = new HelloI(communicator().getProperties().getProperty("Ice.ProgramName"));

            adapter.add(hello, Ice.Util.stringToIdentity("hello"));
            adapter.activate();
            communicator().waitForShutdown();
            return(0);
        }
예제 #3
0
파일: Server.cs 프로젝트: zhj149/ice-demos
    public static int Main(string[] args)
    {
        int status = 0;

        try
        {
            //
            // using statement - communicator is automatically destroyed
            // at the end of this statement
            //
            using (var communicator = Ice.Util.initialize(ref args))
            {
                //
                // Destroy the communicator on Ctrl+C or Ctrl+Break
                //
                Console.CancelKeyPress += (sender, eventArgs) => communicator.destroy();

                if (args.Length > 0)
                {
                    Console.Error.WriteLine("too many arguments");
                    status = 1;
                }
                else
                {
                    var adapter = communicator.createObjectAdapter("Hello");
                    var hello   = new HelloI(communicator.getProperties().getProperty("Ice.ProgramName"));
                    adapter.add(hello, Ice.Util.stringToIdentity("hello"));
                    adapter.activate();
                    communicator.waitForShutdown();
                }
            }
        }
        catch (Exception ex)
        {
            Console.Error.WriteLine(ex);
            status = 1;
        }

        return(status);
    }