Esempio n. 1
0
        public PCSServices getPCSServices(string url)
        {
            //Getting the PCSServices object
            PCSServices obj = (PCSServices)Activator.GetObject(typeof(PCSServices), url);

            return(obj);
        }
Esempio n. 2
0
        private void StartProcesses()
        {
            foreach (string opx in config.Keys)
            {
                ConfigInfo c;
                config.TryGetValue(opx, out c);
                ArrayList urls = c.Urls;
                foreach (string url in urls)
                {
                    //For each url contact the PCS in the ip of that url and tell him to create a replica
                    string      urlOnly = getIPFromUrl(url);
                    PCSServices pcs     = getPCSServices("tcp://" + urlOnly + ":" +
                                                         PCS_PORT + "/" + PCSSERVER_NAME);

                    //Create replica
                    pcs.createOperator(getPortFromUrl(url), getNameFromUrl(url));

                    //Connection with the operator
                    RepServices rs = getRepServices(url);

                    if (!repServices.ContainsKey(opx))
                    {
                        repServices.Add(opx, new ArrayList());
                    }
                    //Save replica service
                    ArrayList array;
                    repServices.TryGetValue(opx, out array);
                    array.Add(rs);
                }
            }
        }
        static void Main(string[] args)
        {
            //Creating the channel
            TcpChannel serverChannel = new TcpChannel(10001);

            ChannelServices.RegisterChannel(serverChannel, false);
            PCSServices pcss = new PCSServices();

            RemotingServices.Marshal(pcss, "PCSServer", typeof(PCSServices));
            System.Console.WriteLine("<enter> para sair...");
            System.Console.ReadLine();
        }