using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Net.NetworkInformation; //引用Ping命名空间
namespace c1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Ping pingSender = new Ping();
PingReply reply = pingSender.Send(txtIP.Text);
if (reply.Status == IPStatus.Success)
{
MessageBox.Show("Ping得通!");
}
else
{
MessageBox.Show("Ping不通!");
}
}
}
}