예제 #1
0
        public static void Main(string[] args)
        {
            Console.Clear();
            Console.WriteLine();
            Console.WriteLine("PCS");
            Console.WriteLine("listening on tcp://" + PCS.GetLocalIPAddress() + ":11000/pcs");

            TcpChannel channel = new TcpChannel(1100);

            ChannelServices.RegisterChannel(channel, false);

            PCS pcs = new PCS();

            RemotingServices.Marshal(pcs, "pcs");

            createReplica("", "", "", 10, 10, false);
            createReplica("", "", "", 10, 10, true);
            createReplica("", "", "", 10, 10, true);


            // Dont close console
            Console.ReadLine();

            // Close TcpChannel
            channel.StopListening(null);
            RemotingServices.Disconnect(pcs);
            ChannelServices.UnregisterChannel(channel);
            channel = null;
        }
예제 #2
0
        public static void Main(string[] args)
        {
            Console.Clear();
            Console.WriteLine();
            Console.WriteLine("PCS");
            Console.WriteLine(args[0]);

            channel = new TcpChannel(11000);
            ChannelServices.RegisterChannel(channel, false);

            pcs = new PCS();
            RemotingServices.Marshal(pcs, "pcs", typeof(IPCS));

            // Dont close console
            Console.ReadLine();

            // Close TcpChannel
            channel.StopListening(null);
            RemotingServices.Disconnect(pcs);
            ChannelServices.UnregisterChannel(channel);
            channel = null;
        }
예제 #3
0
        static public IPCS checkPCS(string pcs_url)
        {
            if (pcsList.Any(item => item.Equals(pcs_url)))
            {
                return(pcs[pcs_url]);
            }
            else
            {
                if (pcsAlive == 1)
                {
                    pcsList.Remove(pcs_url);
                    pcs.Remove(pcs_url);
                    remote = RemotingServices.Connect(typeof(IPCS),
                                                      "tcp://localhost:11000/PCS") as IPCS;
                    try
                    {
                        remote.close();
                    }
                    catch { }

                    //System.Threading.Thread.Sleep(5000);
                    pcsAlive = 0;
                }
                ProcessStartInfo info = new ProcessStartInfo(PCS.exe_path(), pcs_url);
                info.CreateNoWindow = false;

                remote = RemotingServices.Connect(typeof(IPCS),
                                                  "tcp://localhost:11000/PCS") as IPCS;

                pcsList.Add(pcs_url);
                pcs.Add(pcs_url, remote);

                pcsAlive = 1;
                Process.Start(info);


                return(pcs[pcs_url]);
            }
        }