日期:2014-05-18 浏览次数:21113 次
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)
{
}
}
}