在使用时,先引用 using System.Net.NetworkInformation;
Ping pingSender = new Ping(); PingReply reply = pingSender.Send("127.0.0.1"); if (reply.Status == IPStatus.Success) { MessageBox.Show("OK"); } else { MessageBox.Show("NO"); }
在使用时,先引用 using System.Net.NetworkInformation;
Ping pingSender = new Ping(); PingReply reply = pingSender.Send("127.0.0.1"); if (reply.Status == IPStatus.Success) { MessageBox.Show("OK"); } else { MessageBox.Show("NO"); }