Пример #1
0
            private void udp_mDataReciveString(object o, RecieveStringArgs e)
            {
                string[] buff = e.ReadStr.Split('~');
                if (buff == null || buff.Length < 3)
                {
                    return;
                }
                switch (buff[0])
                {
                case "Access":
                    if (buff.Length == 4)
                    {
                        if (buff[3].ToInt() == this.LocalPort)
                        {
                            allowAccess = true;
                        }
                        if (buff[1].ToInt() == random && buff[2].ToInt() == this.LocalPort)
                        {
                            sendAccess = true;
                        }
                    }
                    break;

                case "Del":
                    if (buff[1].ToInt() == random && buff[2].ToInt() == this.LocalPort)
                    {
                        delAccess = true;
                    }
                    break;
                }
            }
Пример #2
0
            private void udp_mDataReciveString(object o, RecieveStringArgs e)
            {
                string result = e.ReadStr;

                string[] buff = result.Split('~');
                if (buff == null || buff.Length < 3)
                {
                    return;
                }
                switch (buff[0])
                {
                case "Access":
                    if (!OneByOne.Contains(buff[2].ToInt()))
                    {
                        OneByOne.Add(buff[2].ToInt());
                    }
                    if (OneByOne.Count > 0)
                    {
                        result = string.Format("{0}~{1}", result, OneByOne[0]);
                    }
                    else
                    {
                        result = string.Format("{0}~{1}", result, -1);
                    }
                    break;

                case "Del":
                    if (OneByOne.Contains(buff[2].ToInt()))
                    {
                        OneByOne.Remove(buff[2].ToInt());
                    }
                    break;
                }
                udp.fUdpSend(e.RemostHost, e.RemotPort, result);
            }
Пример #3
0
 private void mUdp_mDataReciveString(object o, RecieveStringArgs e)
 {
     if (e.ReadStr == "B~OK")
     {
         is_B_Ok = true;
     }
 }