Beispiel #1
0
        void Crash(string id)
        {
            Pcs P = (Pcs)Activator.GetObject(typeof(Pcs), (string)PCS[0]);

            serverCrash RemoteDel = new serverCrash(P.Crash);

            IAsyncResult RemAr = RemoteDel.BeginInvoke(id, null, null);

            Servers.Remove(id);
        }
Beispiel #2
0
        public void StartClient(string pid, string pcsURL, string clientURL, int ms, int nPlayers, string filename = null)
        {
            ProcessCreationService.ProcessCreationService processCreationService = (ProcessCreationService.ProcessCreationService)
                                                                                   Activator.GetObject(
                typeof(ProcessCreationService.ProcessCreationService), pcsURL);
            processCreationService.StartClient(pid, clientURL, _serverURL, ms, nPlayers, filename);

            lock (_puppetAddresses) {
                _puppetAddresses[pid] = clientURL;
            }
        }
Beispiel #3
0
        public void StartServer(string pid, string pcsURL, string serverURL, int ms, int nPlayers)
        {
            _serverURL = serverURL;
            ProcessCreationService.ProcessCreationService processCreationService = (ProcessCreationService.ProcessCreationService)
                                                                                   Activator.GetObject(
                typeof(ProcessCreationService.ProcessCreationService), pcsURL);
            processCreationService.StartServer(pid, _serverURL, ms, nPlayers);

            lock (_puppetAddresses) {
                _puppetAddresses[pid] = serverURL;
            }
        }
Beispiel #4
0
        //Starts a server available at URL
        void StartServer(string serverid, string URL, int mindelay, int maxdelay, string serverid2)
        {
            //Process Creation Service that we are going to use

            string PCStoUse = "none";

            //Search for the list of PCS and choose what to use
            for (int i = 0; i < PCS.Count; i++)
            {
                if ((getIP((string)PCS[i])).Equals(getIP(URL)))
                {
                    PCStoUse = (string)PCS[i];
                }
            }

            //If we need to get a state from another server
            if (serverid2.Trim().Count() == 0)
            {
                //if there is a server to get state from
                if (!(Servers.Count() == 0))
                {
                    //Choose the oldest one
                    serverid2 = Servers.ElementAt(0).Value;
                }

                //if there is a server to get state from
                else
                {
                    serverid2 = "none";
                }
            }
            //add to the list of servers
            Servers.Add(serverid, URL);

            //get the PCS remote object
            Pcs P = (Pcs)Activator.GetObject(typeof(Pcs), PCStoUse);

            startServerDel RemoteDel = new startServerDel(P.StartServer);

            //make the async call
            IAsyncResult RemAr = RemoteDel.BeginInvoke(serverid, URL, mindelay, maxdelay, serverid2, this.algorithm, this.mode, null, null);
        }
Beispiel #5
0
        //Starts a client available at URL
        void StartClient(string clientid, string URL, string script)
        {
            //Process Creation Service that we are going to use
            string PCStoUse = "none";

            string serverurl;

            for (int i = 0; i < PCS.Count; i++)
            {
                if ((getIP((string)PCS[i])).Equals(getIP(URL)))
                {
                    PCStoUse = (string)PCS[i];
                }
            }
            //add to the list of servers
            Clients.Add(clientid, URL);

            //get the PCS remote object
            Pcs P = (Pcs)Activator.GetObject(typeof(Pcs), PCStoUse);

            //if there is no server to ask
            if (Servers.Count() == 0)
            {
                serverurl = "none";
            }
            //if there is we get a random one
            else
            {
                serverurl = Servers.ElementAt(random.Next(0, Servers.Count - 1)).Value;
            }

            startClientDel RemoteDel = new startClientDel(P.StartClient);

            //make the async call
            IAsyncResult RemAr = RemoteDel.BeginInvoke(script, random.Next().ToString(), serverurl, this.algorithm, this.mode, null, null);
        }