/// <summary> /// The main entry point for the application. /// </summary> public static void Main() { RemotingConfiguration.Configure("Client.exe.config", true /*ensureSecurity*/); ISharedInterface remoteObject = (ISharedInterface)Activator.GetObject(typeof(ISharedInterface), "tcp://localhost:8080/server.rem"); Console.WriteLine("Server responds: " + remoteObject.HelloWorld("Hi Server")); }
/// <summary> /// The main entry point for the application. /// </summary> public static void Main() { try { ISharedInterface remoteObject = (ISharedInterface)Activator.GetObject(typeof(ISharedInterface), "ipc://test/server.rem"); Console.WriteLine("Server responds: " + remoteObject.HelloWorld("Hi Server")); } catch (RemotingException e) { Console.WriteLine("An exception has occured: " + e.Message); Console.WriteLine("Perhaps you do not have access to the IPC channel."); Console.WriteLine("Stack trace:\n" + e.StackTrace); } }
/// <summary> /// The main entry point for the application. /// </summary> public static void Main(string[] args) { object remoteObject = Activator.GetObject(typeof(ISharedInterface <string>), "ipc://test/stringRemoteObject.rem"); ISharedInterface <string> stringRemoteObject = remoteObject as ISharedInterface <string>; Console.WriteLine(stringRemoteObject.GetType().ToString()); Console.WriteLine(stringRemoteObject.GetType().IsAssignableFrom(typeof(ISharedInterface <string>))); Console.WriteLine(typeof(ISharedInterface <string>).IsAssignableFrom(stringRemoteObject.GetType())); Console.WriteLine("String Remote Object responds: " + stringRemoteObject.HelloWorld("Hi Server")); Console.WriteLine(); ISharedInterface <int> intRemoteObject = (ISharedInterface <int>)Activator.GetObject(typeof(ISharedInterface <int>), "ipc://test/intRemoteObject.rem"); Console.WriteLine("Int Remote Object responds: " + intRemoteObject.HelloWorld(42)); }
private string ExtractInfo(ISharedInterface Item) { string Name = Item.GetType().Assembly.GetName().Name + " " + Item.ToString(); var CustomInfoCopyrightCall = g_Weather.GetType().Assembly.GetCustomAttributes(typeof(System.Reflection.AssemblyCopyrightAttribute), false); System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(Name).Append(Environment.NewLine); sb.Append('_', Name.Length).Append(Environment.NewLine); if (CustomInfoCopyrightCall.Length > 0) { sb.Append("Copyright: ").Append(((System.Reflection.AssemblyCopyrightAttribute)CustomInfoCopyrightCall[0]).Copyright).Append(Environment.NewLine); } sb.Append("Version: ").Append(g_Weather.GetType().Assembly.GetName().Version.ToString()).Append(Environment.NewLine); sb.Append("Debug Info: ").Append(Item.Debug()).Append(Environment.NewLine).Append(Environment.NewLine); return(sb.ToString()); }
private string ExtractInfo(ISharedInterface Item) { string text = Item.GetType().Assembly.GetName().Name + " " + Item.ToString(); object[] customAttributes = g_Weather.GetType().Assembly.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), inherit: false); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(text).Append(Environment.NewLine); stringBuilder.Append('_', text.Length).Append(Environment.NewLine); if (customAttributes.Length != 0) { stringBuilder.Append("Copyright: ").Append(((AssemblyCopyrightAttribute)customAttributes[0]).Copyright).Append(Environment.NewLine); } stringBuilder.Append("Version: ").Append(g_Weather.GetType().Assembly.GetName().Version.ToString()).Append(Environment.NewLine); stringBuilder.Append("Debug Info: ").Append(Item.Debug()).Append(Environment.NewLine) .Append(Environment.NewLine); return(stringBuilder.ToString()); }
/// <summary> /// The main entry point for the application. /// </summary> public static void Main(string[] args) { ISharedInterface remoteObject = (ISharedInterface)Activator.GetObject(typeof(ISharedInterface), "ipc://test/server.rem"); Console.WriteLine("Server responds: " + remoteObject.HelloWorld("Hi Server")); }
public SharedInterface(string name, ISharedInterface parent, IList<IColumInfoModel> containsColumns) { Name = name; Parent = parent; ContainsColumns = containsColumns; }