Beispiel #1
0
        public Socket socket_server;//接收指定读写器信息的udp服务端,不用的时候要关闭

        public ZigbeeInfo(string _name, string _comport, string _sendtype, string _ips)
        {
            this.name = _name;
            try
            {
                this.name     = _name;
                this.comport  = _comport;
                this.sendType = _sendtype;

                this.ips = _ips;
                string[] ips = _ips.Split(';');
                for (int i = 0; i < ips.Length; i++)
                {
                    if (ips[i].Length > 0)
                    {
                        string[] ip_and_port_s = ips[i].Split(':');
                        if (ip_and_port_s.Length < 2)
                        {
                            continue;
                        }
                        IPAddress ip     = IPAddress.Parse(ip_and_port_s[0]);
                        int       port   = int.Parse(ip_and_port_s[1]);
                        IP_info   ipinfo = new IP_info(ip, port);
                        //IPAddress ip = IPAddress.Parse(ips[i]);
                        this.ipList.Add(ipinfo);
                    }
                }
            }
            catch (System.Exception ex)
            {
                Debug.WriteLine(
                    string.Format("ReaderInfo.ReaderInfo  ->  = {0}"
                                  , ex.Message));
            }
        }
Beispiel #2
0
        public Socket socket_server;//接收指定读写器信息的udp服务端,不用的时候要关闭

        public ReaderInfo(string _name, string _ip, string _port, string _flag, string _sendtype,
                          string _interval, string _ips)
        {
            this.name = _name;
            try
            {
                this.ip = IPAddress.Parse(_ip);
                if (_port != null && _port.Length > 0)
                {
                    this.port = int.Parse(_port);
                }
                this.flag     = _flag;
                this.sendType = _sendtype;
                if (_interval != null && _interval.Length > 0)
                {
                    this.interval  = int.Parse(_interval);
                    this.interval *= 1000;
                }
                this.ips = _ips;
                string[] ips = _ips.Split(';');
                for (int i = 0; i < ips.Length; i++)
                {
                    if (ips[i].Length > 0)
                    {
                        string[] ip_and_port_s = ips[i].Split(':');
                        if (ip_and_port_s.Length < 2)
                        {
                            continue;
                        }
                        IPAddress ip     = IPAddress.Parse(ip_and_port_s[0]);
                        int       port   = int.Parse(ip_and_port_s[1]);
                        IP_info   ipinfo = new IP_info(ip, port);
                        //IPAddress ip = IPAddress.Parse(ips[i]);
                        this.ipList.Add(ipinfo);
                    }
                }
            }
            catch (System.Exception ex)
            {
                Debug.WriteLine(
                    string.Format("ReaderInfo.ReaderInfo  ->  = {0}"
                                  , ex.Message));
            }
        }