问题描述
它仅使用第一个IP地址而不是第二个吗?
Its taking first IP address only not second one?
int [] bping = {"192.168.1.1","192.168.1.2" };
int[] bping = { "192.168.1.1", "192.168.1.2" };
for(int i = 0; 1< bping.Length; i ++)
{
ping ping = new Ping();
PingReply pingReply = ping.Send(bping [i] .ToString());
for (int i = 0; 1<bping.Length; i++)
{
Ping ping = new Ping();
PingReply pingReply = ping.Send(bping[i].ToString());
Console.WriteLine("Status:{0}",pingReply.Status +" + pingReply.Address);
Console.ReadLine();
}
Console.WriteLine("Status: {0}", pingReply.Status + " " + pingReply.Address);
Console.ReadLine();
}
推荐答案
string[] bping = { "192.168.1.1", "192.168.1.2" };for (int i = 0; i < bping.Length; i++){ Ping ping = new Ping(); PingReply pingReply = ping.Send(bping[i].ToString()); Console.WriteLine("Status: {0}", pingReply.Status + " " + pingReply.Address); }Console.ReadLine();
这篇关于平电脑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!