Проверяет пинг на наличие интернета
Добавлено: 11 фев 2024, 10:10
https://github.com/markondej/cpp-icmplib
https://www.codespeedy.com/check-internet-connection-in-c/
Проверяет пинги:
Проверяет dns:
https://bbs.archlinux.org/viewtopic.php?id=213878
https://www.codespeedy.com/check-internet-connection-in-c/
Проверяет пинги:
Код: Выделить всё
if (system("ping -c1 www.google.com"))
{
qDebug() <<"There is no internet connection \n";
}
else
qDebug() << "-> connection established!\n";
Код: Выделить всё
char *hostname;
struct hostent *hostinfo;
hostname = "google.com";
hostinfo = gethostbyname (hostname);
if (hostinfo == NULL)
{
cout <<"There is no internet connection \n";
}
else
cout << "-> connection established!\n";