public static void Main(string[] args) { try { string nameServiceHost = "localhost"; int nameServicePort = 1050; parseArgs(ref nameServiceHost, ref nameServicePort, args); Console.WriteLine("input the two summands"); Console.WriteLine("sum1:"); double sum1 = Double.Parse(Console.ReadLine()); Console.WriteLine("sum2:"); double sum2 = Double.Parse(Console.ReadLine()); // register the channel IiopClientChannel channel = new IiopClientChannel(); ChannelServices.RegisterChannel(channel, false); // access COS nameing service RmiIiopInit init = new RmiIiopInit(nameServiceHost, nameServicePort); NamingContext nameService = init.GetNameService(); NameComponent[] name = new NameComponent[] { new NameComponent("ch.elca.iiop.demo.ejbAdder.AdderHome", "") }; // get the reference to the adder-home AdderHome adderHome = (AdderHome)nameService.resolve(name); // create Adder Adder adder = adderHome.create(); // call add double result = adder.add(sum1, sum2); Console.WriteLine("result: " + result); // dispose the ejb adder.remove(); } catch (Exception e) { Console.WriteLine("exception: " + e); } }