我想要获取我的网络上连接的所有计算机的列表,并且我能够这样做。如何从字符串中分离数据
但是,然后我需要获取我以String格式存储的Ip地址的Hostanme以及其他一些数据,例如mac地址。
我尝试过使用json但是无法从字符串中获取Ip列表。我只列出从字符串的IP,这样使用的foreach我能找到在特定的主机名的
这里是代码:
static void Main(String[] args)
{
Process arp = new Process();
arp.StartInfo.UseShellExecute = false;
arp.StartInfo.RedirectStandardOutput = true;
arp.StartInfo.FileName = "C://Windows//System32//cmd.exe";
arp.StartInfo.Arguments = "/c arp -a";
arp.StartInfo.RedirectStandardOutput = true;
arp.Start();
arp.WaitForExit();
string output = arp.StandardOutput.ReadToEnd();
Console.WriteLine(output);
Console.WriteLine(data.Internet_Address);
Console.ReadLine();
}
}
这里是输出:
请以文本形式添加输入和所需的输出而不是图像。 – Adil
这是(** data.Internet_Address **)从哪里来的? –
为什么不能直接获取这些信息而不是调用命令行工具并解析其输出? –