示例#1
0
        private void connect_Click(object sender, EventArgs e)
        {
            int port = Int32.Parse(portBox.Text);

            TcpChannel chan = new TcpChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            RemotingConfiguration.RegisterWellKnownServiceType(
                typeof(PSlaveService), "Slave",
                WellKnownObjectMode.Singleton);

            Invoke(new DelAddMsg(AddMsg), "Trying ..." + "tcp://localhost:8086/PMServer");

            // Get the PMServerInterface instance that is registerd at port 8086
            PMServerInterface server = (PMServerInterface)Activator.GetObject(typeof(PMServerInterface),
                                                                              "tcp://localhost:8086/PMServer");

            Invoke(new DelAddMsg(AddMsg), "Connected: " + " tcp://localhost:8086/PMServer");

            PSlaveService.server = server;

            PSlaveService.server.MsgToMaster("Estabilished: " + " tcp://localhost:8086/PMServer");

            //foreach (object o in messages)
            //{
            //   AddMsg((string)o);
            //}
        }
示例#2
0
        public void setServerInterface()
        {
            PMServerInterface remotePMservice = (PMServerInterface)Activator.
                                                GetObject(typeof(PMServerInterface),
                                                          "tcp://localhost:8086/RemotePMService");

            addMsgToLog("Connected: " + "tcp://localhost:8086/RemotePMService");
            this.remotePMservice = remotePMservice;
            this.remotePMservice.MsgToMaster("Connection Estabilshed");
        }
示例#3
0
 public void setRemoteInterface(string url)
 {
     if (url.Equals("8086"))
     {
         SingleMachine = true;
         PMServerInterface remotePMservice = (PMServerInterface)Activator.
                                             GetObject(typeof(PMServerInterface),
                                                       "tcp://localhost:8086/RemotePMService");
         Console.WriteLine("Connected: " + "tcp://localhost:8086/RemotePMService");
         this.remotePM = remotePMservice;
         this.remotePM.MsgToMaster("Connection with broker: " + brokerData.name + " Estabilshed");
     }
     else
     {
         SingleMachine = false;
         PSlavesInterface slave = (PSlavesInterface)Activator.GetObject(typeof(PSlavesInterface),
                                                                        "tcp://localhost:" + url + "/Slave");
         Console.WriteLine("Connected to remoteSlave: " + url);
         remoteSlave = slave;
     }
 }