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;
private void button1_Click(object sender, EventArgs e)
{
Ping pinger = new Ping();
PingReply reply=pinger.Send("www.baidu.com");
if (reply.Status == IPStatus.Success)
{
MessageBox.Show(reply.RoundtripTime.ToString());
}
}