昨天加了一个定时器:
mCheckConnectTimer = new System.Windows.Forms.Timer();
mCheckConnectTimer.Interval = Settings.Default.CheckConnectTimer * 1000 * 60;//N分钟检测
mCheckConnectTimer.Tick += new EventHandler(mCheckConnectTimer_Tick);
mCheckConnectTimer.Enabled = true;
void mCheckConnectTimer_Tick(object sender, EventArgs e)
{ ConfigData cfgData = ReadConfigFile();
string strIP = cfgData.Sip_Proxy_Name;
Ping pingSender = new Ping();
PingOptions pingOption = new PingOptions();
pingOption.DontFragment = true;
int timeout = 2000;//超时时间为2秒
PingReply reply = pingSender.Send(strIP, timeout);
if (reply.Status == IPStatus.Success)
{
//MessageBox.Show("能ping通 ");
if (this.mPttRegSuccess == false)
{}
}
else
{
//MessageBox.Show("ping不通");
if (this.mPttRegSuccess)
{ }
}
}昨晚运行了一晚上,icmp包正常显示,每5分钟ping了一次目的ip。
结果今天十点多的时候,发现ping的时间间隔不对,变成了每30秒一次。
时间间隔为原来的十分之一,想问问版上的人,这是个什么问题。
mCheckConnectTimer = new System.Windows.Forms.Timer();
mCheckConnectTimer.Interval = Settings.Default.CheckConnectTimer * 1000 * 60;//N分钟检测
mCheckConnectTimer.Tick += new EventHandler(mCheckConnectTimer_Tick);
mCheckConnectTimer.Enabled = true;
void mCheckConnectTimer_Tick(object sender, EventArgs e)
{ ConfigData cfgData = ReadConfigFile();
string strIP = cfgData.Sip_Proxy_Name;
Ping pingSender = new Ping();
PingOptions pingOption = new PingOptions();
pingOption.DontFragment = true;
int timeout = 2000;//超时时间为2秒
PingReply reply = pingSender.Send(strIP, timeout);
if (reply.Status == IPStatus.Success)
{
//MessageBox.Show("能ping通 ");
if (this.mPttRegSuccess == false)
{}
}
else
{
//MessageBox.Show("ping不通");
if (this.mPttRegSuccess)
{ }
}
}昨晚运行了一晚上,icmp包正常显示,每5分钟ping了一次目的ip。
结果今天十点多的时候,发现ping的时间间隔不对,变成了每30秒一次。
时间间隔为原来的十分之一,想问问版上的人,这是个什么问题。
void mCheckConnectTimer_Tick(object sender, EventArgs e)
{
if(runing)
return;
runing=true;
ConfigData cfgData = ReadConfigFile();
string strIP = cfgData.Sip_Proxy_Name;
Ping pingSender = new Ping();
PingOptions pingOption = new PingOptions();
pingOption.DontFragment = true;
int timeout = 2000;//超时时间为2秒
PingReply reply = pingSender.Send(strIP, timeout);
if (reply.Status == IPStatus.Success)
{
//MessageBox.Show("能ping通 ");
if (this.mPttRegSuccess == false)
{}
}
else
{
//MessageBox.Show("ping不通");
if (this.mPttRegSuccess)
{ }
}runing=false;
}