1 ping类
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.NetworkInformation;
using System.Threading;
using System.Windows.Forms;
namespace TestLoadForm
{
class PingIp
{
Thread thread;
int ping_time = 2000;
System.Timers.Timer timer;
public string Ip;
public delegate void PingHandle(string ip,bool flag);
public event PingHandle pingEvent;
public PingIp(string ip)
{
Ip = ip;
thread = new Thread(new ThreadStart(RunSecondThread));
thread.Start();
}
void RunSecondThread()
{
timer = new System.Timers.Timer(ping_time);
timer.AutoR