当前位置:网站首页>读取xml文件里switch节点的IP和设备信息,ping设备,异常显示在列表里
读取xml文件里switch节点的IP和设备信息,ping设备,异常显示在列表里
2022-07-28 05:29:00 【angleoldhen】
{
treeView1.Nodes.Clear();
Ping pingSender = new Ping();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("ip.xml");
XmlNodeList xnList = xmlDoc.SelectNodes("//switch");
foreach (XmlNode xn in xnList)
{
string switch_ip = (xn.SelectSingleNode("ip")).InnerText;
string switch_info = xn.SelectSingleNode("info").InnerText;
PingReply reply = pingSender.Send(switch_ip, 120);//第一个参数为ip地址,第二个参数为ping的时间
if (reply.Status != IPStatus.Success)
{
treeView1.Nodes.Add(switch_ip + " ( " + switch_info + ")");
}
}
}
xml文件内容形如:
<?xml version="1.0" encoding="GB2312" standalone="yes" ?>
<company>
<switch>
<ip>192.168.10.1</ip>
<info>H3C 5500交换机</info>
</switch>
<switch>
<ip>192.168.10.2</ip>
<info>H3C-S3100交换机</info>
</switch>
</company>
边栏推荐
- NAT-网络地址转换
- Wechat applet custom compilation mode
- Group management and permission management
- Applets: lifecycle
- Technology sharing | how to do Assertion Verification in interface automated testing?
- MOOC Weng Kai C language week 3: judgment and circulation: 2. circulation
- 小甲鱼C(第五章循环控制结构程序567)break和continue语句
- joern运行后.joernindex数据库无内容
- Svg understanding and drawing application
- Canvas drawing 1
猜你喜欢

About gcc:multiple definition of

PXE无人值守安装管理

Blue Bridge Cup square filling number

远程访问云服务器上Neo4j等服务的本地网址

Custom component -- pure data field & component life cycle

MOOC翁恺C语言第八周:指针与字符串:1.指针2.字符类型3.字符串4.字符串计算

joern运行后.joernindex数据库无内容

Esxi community nvme driver update v1.1

爬虫学习总结

DNS forward resolution experiment
随机推荐
Escape character notes
Principle and configuration of NAT and pat
Bert的实现方法
MySQL installation and use
NAT-网络地址转换
New, let, VaR, const and temporary deadband. The difference between XML and JSON
DOM window related data, operations & BOM operations
多进程(多核运算)Multiprocessing
DHCP principle and configuration
[learning notes] drive
MOOC Weng Kai C language week 6: arrays and functions: 1. Arrays 2. Definition and use of functions 3. Parameters and variables of functions 4. Two dimensional arrays
MOOC Weng Kai C language week 3: judgment and cycle: 1. Judgment
[learning notes] knowledge management
Clock tree analysis example
Applet creation component
Monotonic queue, Luogu p1886 sliding window
DOM Foundation
Asynchronous programming promise
Esxi community nvme driver update v1.1
codesensor:将代码转化为ast后再转化为文本向量