public BuddyListForm(string server) { InitializeComponent(); if (server == null || server.Length == 0) { server = "localhost"; } string url = String.Format("tcp://{0}:8892/ArtooService", server); ChannelServices.RegisterChannel(new TcpChannel()); WellKnownClientTypeEntry remotetype = new WellKnownClientTypeEntry(typeof(ArtooService), "tcp://localhost:8892/ArtooService"); RemotingConfiguration.RegisterWellKnownClientType(remotetype); Service = new ArtooService(); ChatBoxes = new ArrayList(); }
public static void Main(String[] args) { TcpChannel channel = new TcpChannel(8892); ChannelServices.RegisterChannel(channel); ArtooService service = new ArtooService(); ObjRef obj = RemotingServices.Marshal(service, "ArtooService"); Console.WriteLine("Artoo IM Server started. Press ENTER to stop."); Console.ReadLine(); service.Shutdown(); RemotingServices.Unmarshal(obj); RemotingServices.Disconnect(service); }