示例#1
0
        public void SND2()
        {
            string s  = ReadC();
            int    id = ReadI();
            MqS    cl = SlaveGet(id);

            SendSTART();
            if (s == "CREATE")
            {
                List <string> LIST = new List <string>();
                while (ReadItemExists())
                {
                    LIST.Add(ReadC());
                }
                LIST.Add("--name");
                LIST.Add("wk-cl-" + id);
                LIST.Add("@");
                LIST.Add("--name");
                LIST.Add("wk-sv-" + id);
                SlaveWorker(id, LIST.ToArray());
            }
            else if (s == "CREATE2")
            {
                Client c = new Client();
                c.LinkCreate(ConfigGetDebug());
                SlaveCreate(id, c);
            }
            else if (s == "CREATE3")
            {
                ClientERR c = new ClientERR();
                c.LinkCreate(ConfigGetDebug());
                SlaveCreate(id, c);
            }
            else if (s == "DELETE")
            {
                SlaveDelete(id);
                SendC(SlaveGet(id) == null ? "OK" : "ERROR");
            }
            else if (s == "SEND")
            {
                cl.SendSTART();
                String TOK = ReadC();
                ReadProxy(cl);
                cl.SendEND(TOK);
            }
            else if (s == "WAIT")
            {
                cl.SendSTART();
                cl.SendN(ReadN());
                cl.SendEND_AND_WAIT("ECOI", 5);
                SendI(cl.ReadI() + 1);
            }
            else if (s == "CALLBACK")
            {
                cl.SendSTART();
                ReadProxy(cl);
                i = -1;
                cl.SendEND_AND_CALLBACK("ECOI", ((Server)cl).SetMyInt);
                cl.ProcessEvent(10, MqS.WAIT.ONCE);
                SendI(i + 1);
            }
            else if (s == "MqSendEND_AND_WAIT")
            {
                string TOK = ReadC();
                cl.SendSTART();
                while (ReadItemExists())
                {
                    ReadProxy(cl);
                }
                cl.SendEND_AND_WAIT(TOK, 5);
                while (cl.ReadItemExists())
                {
                    cl.ReadProxy(this);
                }
            }
            else if (s == "MqSendEND")
            {
                string TOK = ReadC();
                cl.SendSTART();
                while (ReadItemExists())
                {
                    ReadProxy(cl);
                }
                cl.SendEND(TOK);
                return;
            }
            else if (s == "ERR-1")
            {
                ClientERR2 c = new ClientERR2();
                c.LinkCreate(ConfigGetDebug());
            }
            else if (s == "isSlave")
            {
                SendO(cl.SlaveIs());
            }
            SendRETURN();
        }
示例#2
0
        public void SND2()
        {
            string s = ReadC();
              int id = ReadI();
              MqS cl = SlaveGet(id);

              SendSTART();
            if (s == "CREATE") {
              List<string> LIST = new List<string>();
              while (ReadItemExists())
            LIST.Add(ReadC());
              LIST.Add("--name");
              LIST.Add("wk-cl-" + id);
              LIST.Add("@");
              LIST.Add("--name");
              LIST.Add("wk-sv-" + id);
              SlaveWorker(id, LIST.ToArray());
            } else if (s == "CREATE2") {
              Client c = new Client();
              c.LinkCreate(ConfigGetDebug());
              SlaveCreate (id, c);
            } else if (s == "CREATE3") {
              ClientERR c = new ClientERR();
              c.LinkCreate(ConfigGetDebug());
              SlaveCreate (id, c);
            } else if (s == "DELETE") {
              SlaveDelete(id);
              SendC(SlaveGet(id) == null ? "OK" : "ERROR");
            } else if (s == "SEND") {
              cl.SendSTART();
              String TOK = ReadC();
              ReadProxy(cl);
              cl.SendEND(TOK);
            } else if (s == "WAIT") {
              cl.SendSTART();
              cl.SendN(ReadN());
              cl.SendEND_AND_WAIT("ECOI", 5);
              SendI(cl.ReadI()+1);
            } else if (s == "CALLBACK") {
              cl.SendSTART();
              ReadProxy(cl);
              myInt = -1;
              cl.SendEND_AND_CALLBACK("ECOI", ((Server)cl).SetMyInt);
              cl.ProcessEvent(10, MqS.WAIT.ONCE);
              SendI(myInt+1);
            } else if (s == "MqSendEND_AND_WAIT") {
              string TOK = ReadC();
              cl.SendSTART();
              while (ReadItemExists())
            ReadProxy(cl);
              cl.SendEND_AND_WAIT(TOK, 5);
              while (cl.ReadItemExists())
            cl.ReadProxy(this);
            } else if (s == "MqSendEND") {
              string TOK = ReadC();
              cl.SendSTART();
              while (ReadItemExists())
            ReadProxy(cl);
              cl.SendEND(TOK);
              return;
            } else if (s == "ERR-1") {
              ClientERR2 c = new ClientERR2();
              c.LinkCreate(ConfigGetDebug());
            } else if (s == "isSlave") {
              SendO(cl.SlaveIs());
            }
              SendRETURN();
        }