networkAccessibleChanged signal never gets called
Hello! I am trying to detect when I lose connection to Internet, for example when I cannot load any site or any application that connects to Internet.
I am trying this with QNetworkAccesManager but signal networkAccessibleChanged never gets called.
My code:
Code:
{
this->setGeometry(400, 400, 400, 400);
manager = new QNetworkConfigurationManager();
pManager->setConfiguration(manager->defaultConfiguration());
connect(pManager, &QNetworkAccessManager::networkAccessibleChanged, this, &mainWindow::test);
}
void mainWindow::test(QNetworkAccessManager::NetworkAccessibility access){
qDebug() << access;
}
How can I solve this? Thank you!
Re: networkAccessibleChanged signal never gets called
Quote:
How can I solve this? Thank you!
It is possible that your patience ran out before the OS finally notified your app that the network connection timed out. Depending on the platform, the time interval between the physical loss of a connection and the timeout can be minutes.
Re: networkAccessibleChanged signal never gets called
I don't think that is the problem because I waited 30 minutes without Internet Connection and nothing happened. Do you know other method to react when computer loses Internet Connection?
Re: networkAccessibleChanged signal never gets called
Quote:
Do you know other method to react when computer loses Internet Connection?
It is probably OS-specific. Here's an article on network connection heartbeats which might give you some ideas. Edit - it looks like this might be specific to the RabbitMQ product, whatever that is. But it has to be relying on some underlying protocol implemented at the network stack level.
Re: networkAccessibleChanged signal never gets called
Thank you very much for help!