// //////////////////////////////////////////////////////// // Lecture on the CORBA Component Model, summer term 2003 // Assignment 7, Stephan Brumme, 702544 // // Microsoft .NET client that calls a remote "reverse" operation // // for console output using System; // remoting using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; // reverse operation using ReverseAPI; namespace Aufgabe7 { /// /// Encapsulates the Main method /// class Client { static void Main() { // catch any RemoteException try { // request an available TCP based channel ChannelServices.RegisterChannel(new TcpClientChannel()); // create a proxy for the remote object Reverser proxy = (Reverser)Activator.GetObject(typeof(Reverser), "tcp://localhost:8421/ReverserServer"); // failed ? if (proxy == null) { Console.WriteLine("Invalid reference."); return; } // actually invoke the proxy Console.WriteLine("Reversing the string \"Microsoft .NET\": \"" + proxy.reverse("Microsoft .NET") + "\""); } catch (RemotingException) { // something went wrongs Console.WriteLine("Server not found."); } } } }