| | |
| | | device1.Jsæ·é¡º2.Config.IP, |
| | | device1.ç»´å¸å°æè1.Config.IP, |
| | | device1.ç»´å¸å°æè2.Config.IP, |
| | | device1.RGV.Config.IP |
| | | device1.RGV.Config.IP, |
| | | device1.S1002Read.Config.IP, |
| | | device1.S2001Read.Config.IP, |
| | | device1.S3001Read.Config.IP |
| | | }) |
| | | { |
| | | string pattern = @"\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"; |
| | | |
| | | var matches = Regex.Match(ip, pattern); |
| | | if (matches.Success) |
| | | IsMachineOnline(matches.Value); |
| | | { |
| | | var b = IsMachineOnline(matches.Value); |
| | | if (!Iponlines.ContainsKey(ip)) |
| | | { |
| | | Iponlines.TryAdd(ip, b); |
| | | } |
| | | else |
| | | Iponlines[ip] = b; |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | Task.WaitAll(tasks.ToArray()); |
| | | } |
| | | |
| | | public static ConcurrentDictionary<string, bool> Iponlines = new ConcurrentDictionary<string, bool>(); |
| | | public bool IsMachineOnline(string hostNameOrIp, int timeout = 1000) |
| | | { |
| | | //device.påé£ç§1ä¸çº¿.Config.IP |