Results 1 to 5 of 5

Thread: networkAccessibleChanged signal never gets called

  1. #1
    Join Date
    Jul 2019
    Posts
    32
    Thanks
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default 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:
    Qt Code:
    1. mainWindow::mainWindow(QWidget *parent) : QWidget(parent)
    2. {
    3. this->setGeometry(400, 400, 400, 400);
    4. manager = new QNetworkConfigurationManager();
    5. pManager->setConfiguration(manager->defaultConfiguration());
    6. connect(pManager, &QNetworkAccessManager::networkAccessibleChanged, this, &mainWindow::test);
    7. }
    8.  
    9. void mainWindow::test(QNetworkAccessManager::NetworkAccessibility access){
    10. qDebug() << access;
    11. }
    To copy to clipboard, switch view to plain text mode 

    How can I solve this? Thank you!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: networkAccessibleChanged signal never gets called

    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.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jul 2019
    Posts
    32
    Thanks
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default 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?

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: networkAccessibleChanged signal never gets called

    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.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. #5
    Join Date
    Jul 2019
    Posts
    32
    Thanks
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: networkAccessibleChanged signal never gets called

    Thank you very much for help!

Similar Threads

  1. how to know which signal is called a certain slot?
    By Alex22 in forum Qt Programming
    Replies: 12
    Last Post: 11th December 2015, 12:42
  2. Replies: 3
    Last Post: 1st October 2015, 20:56
  3. QTableView activated signal not called
    By mpi in forum Qt Programming
    Replies: 2
    Last Post: 20th February 2012, 17:29
  4. Qt bug? Signal emitted once, slot called multiple times
    By MattPhillips in forum Qt Programming
    Replies: 22
    Last Post: 1st December 2010, 23:32
  5. Replies: 1
    Last Post: 3rd December 2008, 16:51

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.