public static void Main() { ChannelServices.RegisterChannel(new TcpChannel()); // Register the 'MyServerImpl' object as well known type // at client end. RemotingConfiguration.RegisterWellKnownClientType( typeof(MyServerImpl), "tcp://localhost:8085/SayHello"); // <Snippet1> MyServerImpl myObject = new MyServerImpl(); // Get the assembly for the 'MyServerImpl' object. Assembly myAssembly = Assembly.GetAssembly(typeof(MyServerImpl)); AssemblyName myName = myAssembly.GetName(); // Check whether the specified object type is registered as // well-known client type. WellKnownClientTypeEntry myWellKnownClientType = RemotingConfiguration.IsWellKnownClientType( (typeof(MyServerImpl)).FullName, myName.Name); Console.WriteLine("The Object type :" + myWellKnownClientType.ObjectType); Console.WriteLine("The Object Uri :" + myWellKnownClientType.ObjectUrl); // </Snippet1> Console.WriteLine(myObject.MyMethod("Remote method is called.")); }
static void Main() { try { ChannelServices.RegisterChannel(new TcpChannel()); RemotingConfiguration.RegisterActivatedClientType( typeof(MyServerImpl), "tcp://localhost:8085"); MyServerImpl myObject = new MyServerImpl(); for (int i = 0; i <= 4; i++) { Console.WriteLine(myObject.MyMethod("invoke the server method " + (i + 1) + " time.")); } // <Snippet1> // Check whether the 'MyServerImpl' type is registered as // a remotely activated client type. ActivatedClientTypeEntry myActivatedClientEntry = RemotingConfiguration.IsRemotelyActivatedClientType( typeof(MyServerImpl)); Console.WriteLine("The Object type is " + myActivatedClientEntry.ObjectType); Console.WriteLine("The Application Url is " + myActivatedClientEntry.ApplicationUrl); // </Snippet1> } catch (Exception e) { Console.WriteLine(e.Message); } }
public static void Main() { TcpChannel myChannel = new TcpChannel(); ChannelServices.RegisterChannel(myChannel); MyServerImpl myObject = (MyServerImpl)Activator.GetObject(typeof(MyServerImpl), "tcp://localhost:8085/SayHello"); Console.WriteLine(myObject.MyMethod("ClientString")); }
static void Main() { try { ChannelServices.RegisterChannel(new TcpChannel()); RemotingConfiguration.RegisterActivatedClientType(typeof(MyServerImpl), "tcp://localhost:8085"); MyServerImpl myObject = new MyServerImpl(); for (int i = 0; i <= 4; i++) { Console.WriteLine(myObject.MyMethod("invoke the server method " + (i + 1) + " time")); } } catch (Exception e) { Console.WriteLine(e.Message); } }
public static void Main() { ChannelServices.RegisterChannel(new TcpChannel()); // Register the specified object as well-known type at client end. RemotingConfiguration.RegisterWellKnownClientType( typeof(MyServerImpl), "tcp://localhost:8085/SayHello"); MyServerImpl myObject = new MyServerImpl(); Console.WriteLine(myObject.MyMethod("ClientString")); // <Snippet1> // Get the well-known types registered at the client. WellKnownClientTypeEntry[] myEntries = RemotingConfiguration.GetRegisteredWellKnownClientTypes(); Console.WriteLine("The number of WellKnownClientTypeEntries are:" + myEntries.Length); Console.WriteLine("The Object type is:" + myEntries[0].ObjectType); Console.WriteLine("The Object Url is:" + myEntries[0].ObjectUrl); // </Snippet1> }
static void Main() { try { ChannelServices.RegisterChannel(new TcpChannel()); RemotingConfiguration.RegisterActivatedClientType( typeof(MyServerImpl), "tcp://localhost:8085"); MyServerImpl myObject = new MyServerImpl(); for (int i = 0; i <= 4; i++) { Console.WriteLine(myObject.MyMethod("invoke the server method ")); } // Get the assembly for the 'MyServerImpl' object. // <Snippet1> Assembly myAssembly = Assembly.GetAssembly(typeof(MyServerImpl)); AssemblyName myName = myAssembly.GetName(); // Check whether the 'MyServerImpl' type is registered as // a remotely activated client type. ActivatedClientTypeEntry myActivatedClientEntry = RemotingConfiguration.IsRemotelyActivatedClientType( (typeof(MyServerImpl)).FullName, myName.Name); Console.WriteLine("The Object type : " + myActivatedClientEntry.ObjectType); Console.WriteLine("The Application Url : " + myActivatedClientEntry.ApplicationUrl); if (myActivatedClientEntry != null) { Console.WriteLine("Object is client activated"); } else { Console.WriteLine("Object is not client activated"); } // </Snippet1> } catch (Exception e) { Console.WriteLine(e.Message); } }
public static void Main() { ChannelServices.RegisterChannel(new TcpChannel()); // Register the 'MyServerImpl' object as well known type // at client end. RemotingConfiguration.RegisterWellKnownClientType(typeof(MyServerImpl), "tcp://localhost:8085/SayHello"); MyServerImpl myObject = new MyServerImpl(); Console.WriteLine(myObject.MyMethod("ClientString")); // <Snippet1> // Check whether the specified object type is registered as // well known client type or not. WellKnownClientTypeEntry myWellKnownClientType = RemotingConfiguration.IsWellKnownClientType(typeof(MyServerImpl)); Console.WriteLine("The Object type is " + myWellKnownClientType.ObjectType); Console.WriteLine("The Object Url is " + myWellKnownClientType.ObjectUrl); // </Snippet1> }