Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            try {
                string nameserviceLoc = "corbaloc::localhost:3528/JBoss/Naming/root";
                // the port the callback is listening on
                int callbackPort = 0; // auto assign
                if (args.Length > 0)
                {
                    nameserviceLoc = args[0];
                }
                if (args.Length > 1)
                {
                    callbackPort = Int32.Parse(args[1]);
                }

                IiopChannel channel = new IiopChannel(callbackPort);
                ChannelServices.RegisterChannel(channel, false);

                NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameserviceLoc);

                NameComponent[] name = new NameComponent[] { new NameComponent("demo", ""),
                                                             new NameComponent("chatroomHome", "") };
                // get the chatroom home interface
                ChatroomHome home     = (ChatroomHome)nameService.resolve(name);
                Chatroom     chatroom = home.create();

                Application.Run(new Chatform(chatroom));
            } catch (Exception e) {
                Console.WriteLine("exception: " + e);
            }
        }
Exemplo n.º 2
0
        public static void Main(string[] args)
        {
            try {
                string ejbNameServiceHost = "localhost";
                int    ejbNameServicePort = 7001;
                if (args.Length > 0)
                {
                    ejbNameServiceHost = args[0];
                }
                if (args.Length > 1)
                {
                    ejbNameServicePort = Int32.Parse(args[1]);
                }

                // the port the callback is listening on
                int callbackPort = 0; // auto assign
                if (args.Length > 2)
                {
                    callbackPort = Int32.Parse(args[2]);
                }

                IiopChannel channel = new IiopChannel(callbackPort);
                ChannelServices.RegisterChannel(channel, false);

                RmiIiopInit   init        = new RmiIiopInit(ejbNameServiceHost, ejbNameServicePort);
                NamingContext nameService = init.GetNameService();

                NameComponent[] name = new NameComponent[] { new NameComponent("demo", ""),
                                                             new NameComponent("chatroomHome", "") };
                // get the chatroom home interface
                ChatroomHome home     = (ChatroomHome)nameService.resolve(name);
                Chatroom     chatroom = home.create();

                Application.Run(new Chatform(chatroom));
            } catch (Exception e) {
                Console.WriteLine("exception: " + e);
            }
        }