Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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");
        }
Esempio n. 3
0
        public RemoteServerCoord(int port)
        {
            _rMasterServer = (RemoteMasterServer)Activator.GetObject(
                typeof(RemoteMasterServer),
                "tcp://localhost:8086/MasterServer");

            _url = "tcp://localhost:" + port + "/Server";

            Console.WriteLine("Server URL: " + _url);
        }
Esempio n. 4
0
        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());
        }