我使用Qt
向我的域上的所有服务器发出ping请求我在这里找到灵感:how to check computer's state using Qt?
并且这样做了:
int exitCode = QProcess::execute("ping", QStringList() << "-n 1" << "hostname");
if (0 == exitCode) {
// it's alive
} else {
// it's dead
}
它的工作(主要是)
但是,这是我无法找到解决方案的两个问题:
当我启动时,一些丑陋的Windows控制台会显示所有ping,如何隐藏它们?
DNS已知某些服务器但不再工作:导致ping此消息:
****************> ping oldserverNotWorkingAnymore
sending a 'ping' request for oldserverNotWorkingAnymore.mydomain [172.20.*.*] with 32 bytes of data
response from 172.20.*.* : Impossible to call host
response from 172.20.*.* : Impossible to call host
response from 172.20.*.* : Impossible to call host
response from 172.20.*.* : Impossible to call host
stat : send = 4, received = 4, lost = 0
导致程序认为主机存在而不是
如何区分真正有效的ping?