public void connect(int slavePort) { try { _slavePort = slavePort; _slaveServer = (IDataServer)Activator.GetObject(typeof(IDataServer), PortToUrl(_slavePort)); Console.WriteLine("Backup ServerAt{0} registered", slavePort); SerializableDictionary <int, int> updateall = new SerializableDictionary <int, int> (); foreach (DictionaryEntry pair in PadInts) { Console.WriteLine("{0}={1}", pair.Key, pair.Value); int a = (int)pair.Key; PadInt b = (PadInt)pair.Value; int c = b.Value; updateall.Add(a, c); } _slaveServer.receiveUpdateAll(updateall); if (_isPrimary) { Console.WriteLine(" Connected with the Slave at: " + PortToUrl(_slavePort)); pingService = new Ping(_slaveServer, this); pingService.StartReceive(); } } catch (RemotingException re) { Console.WriteLine("[connect]:\n" + re); throw new OperationException("Server " + name + "cannot connect: SlaveServer is not avaiable."); } }