void TcpClient::run()
{
QProcess *cmd = new QProcess;
QString strCmd = QString("ping %1 -n 1-w %2").arg(m_strDestIP).arg(m_pingTime);
while (1)
{
cmd->start(strCmd);
// 等待ping 的结果
cmd->waitForReadyRead();
cmd->waitForFinished(-1);//等待ping完成
QString result = cmd->readAll();
if(-1 == result.indexOf("TTL"))
{
m_isTcpSmooth = false;//切换成网络不畅通状态
g_tempPara_station.status = false;
qDebug() << myHelper::Instance()->getSystemTime() << "离线";
emit pingError();//发送网络ping不通的信号
}
else
{
qDebug() << myHelper::Instance()->getSystemTime() << "在线";
QThread::sleep(1);
}
}
}