// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections; using System.Runtime.Remoting; using System.Runtime.Remoting.Channels; using System.Runtime.Remoting.Channels.Tcp; using Arne.Remoting.Common; namespace Arne.Remoting.Client { class ClientMain { public static void Main(string[] args) { ChannelServices.RegisterChannel(new TcpClientChannel()); IClientServer ics = (IClientServer)Activator.GetObject(typeof(IClientServer), "tcp://localhost:50000/ArneServer"); Record r1 = ics.GetOne(2); Console.WriteLine(r1); ArrayList lst = ics.GetAll(); for(int i = 0; i < lst.Count; i++) { Record r = (Record)lst[i]; Console.WriteLine(r); } Console.Write("Enter F1: "); int f1 = int.Parse(Console.ReadLine()); Console.Write("Enter F2: "); string f2 = Console.ReadLine(); ics.Insert(new Record(f1, f2)); ArrayList lst2 = ics.GetAll(); for(int i = 0; i < lst2.Count; i++) { Record r = (Record)lst2[i]; Console.WriteLine(r); } } } }