Results 1 to 7 of 7

Thread: No error from QTNetwork if network goes off

  1. #1
    Join Date
    Nov 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question No error from QTNetwork if network goes off

    I have submitted the http get request by calling QNetworkAccessManager::get.
    I have connected to the QNetworkReply signals QNetworkReply::error and
    QNetworkReply::finished.
    While the page is loading, I have removed the network cable off,
    neither QNetworkReply::error signal is emitted nor error code is sent to QNetworkReply::finished signal.

    Please guide if anybody has encountered the same and have a fix.

  2. #2
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: No error from QTNetwork if network goes off

    Hi,

    1) I can test is by myself if you provide the source code.
    2) If you provide the basic implementation we can look for problems.

    Kacper
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  3. #3
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: No error from QTNetwork if network goes off

    Hi!

    I made some project in Qt which had to react on unpluging cable and what I noticed is that it is not OS independent. On Windows you get that windows cloud with "Network cable unplugged... " or something and you can get some event in application (because OS can provide it). I tested my application on Kubuntu and when i unplugged network cable there was no reaction. I used only tcp socket and server, so I don't know how much it's connected with your classes but maybe it can help you.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: No error from QTNetwork if network goes off

    Basically there is no reliable way of determining if the network is down. Pulling out a cable from the socket doesn't yet mean a particular connection has been broken. What if it is rerouted using a different interface?

  5. #5
    Join Date
    Nov 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: No error from QTNetwork if network goes off

    Yes exactly. I am also using Ubuntu and the problem exists.

  6. #6
    Join Date
    Nov 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: No error from QTNetwork if network goes off

    I am not using any other interfaces. There is only one interface exist.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: No error from QTNetwork if network goes off

    What if the application is deployed in a different environment? With bluetooth network for instance? What if the signal comes back after a second? A TCP connection will still be valid, right? What if the wire is cut not between your computer and the next network device but further away - you won't notice that yet no more packets will reach their destinations... There is simply no reliable way to determine if a connection is broken or if it is simply delayed. The only thing we have is timers. You may consider a connection broken after some defined amount of time.

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.