MasterServer(int port) { _port = port; _channel = new TcpChannel(_port); ChannelServices.RegisterChannel(_channel, true); RemoteMasterServer obj = new RemoteMasterServer(); try { RemotingServices.Marshal(obj, "MasterServer", typeof(RemoteMasterServer)); } catch (Exception e) { throw e; } }
private void registerOnMasterServerCoord() { _rMasterServer = (RemoteMasterServer)Activator.GetObject( typeof(RemoteMasterServer), "tcp://localhost:8086/MasterServer"); _rMasterServer.registerServerCoord("tcp://localhost:" + _port + "/Server"); /* if (name == "secondary") { //_rServer.setCheckPrimaryLife(); _rServer.setUpServer(name); } else { //_rServer.setImAlive() _rServer.setName("primary"); } */ Console.WriteLine("Server iniciou como coord"); }
public RemoteServerCoord(int port) { _rMasterServer = (RemoteMasterServer)Activator.GetObject( typeof(RemoteMasterServer), "tcp://localhost:8086/MasterServer"); _url = "tcp://localhost:" + port + "/Server"; Console.WriteLine("Server URL: " + _url); }
public static void Init() { _channel = new TcpChannel(0); ChannelServices.RegisterChannel(_channel, true); //InitializeRemoteMasterServer(); _rMasterServer = (RemoteMasterServer)Activator.GetObject( typeof(RemoteMasterServer), "tcp://localhost:8086/MasterServer"); _rServerCoord = (RemoteServerCoord)Activator.GetObject( typeof(RemoteServerCoord), _rMasterServer.getServerCoordUrl()); }