Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt c++ application results QNetworkReply::UnknownNetworkError error after network restart

Qt c++ application results QNetworkReply::UnknownNetworkError error after network restart

Scheduled Pinned Locked Moved Solved QML and Qt Quick
6 Posts 2 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qt_newbee
    wrote on last edited by qt_newbee
    #1

    Hi there,

    I am using Qt5.15 version for my application. My application is a basic server client application and with some custom features like monitoring wifi connection, in Linux. I am initializing a QNetworkAccessManager object to send and receive the data from my AWS server. The application runs without any issue until there is a network connectivity problem. If there is a network connectivity issue (wifi is not connected), I am restarting the network services using Linux commands. After the network is restarted, for the very first call to my AWS server, the QT debug prints are:
    - Network error QNetworkReply::UnknownNetworkError received
    (unknown:0) - QIODevice::read (QDisabledNetworkReply): device not open

    I tried to print the error code, and it was 99. I am not able to find the root cause and unable to make the API call pass. If I restart the application works. What should I do in the QT code to fix the application without restarting the same.

    Looking forward to possible solutions.
    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What if you recreate your QNAM object ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Q 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        What if you recreate your QNAM object ?

        Q Offline
        Q Offline
        qt_newbee
        wrote on last edited by qt_newbee
        #3

        @SGaist Thanks for your response. I cannot create a new object for the QNAM. Because, the same object is being associated to different function. I would need to use the same object for the application. I couldn't get a proper example for re-initializing the QNAM object with the same object name. Could you please help me on that.

        Thanks in Advance!

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4
          delete _qnam;
          _qnam = new QNetworkAccessManager(this);
          // do all the connections.
          

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          Q 2 Replies Last reply
          0
          • SGaistS SGaist
            delete _qnam;
            _qnam = new QNetworkAccessManager(this);
            // do all the connections.
            
            Q Offline
            Q Offline
            qt_newbee
            wrote on last edited by
            #5

            @SGaist Thanks for the code snippet example. I will try the same and update whether it works.

            Best Regards.

            1 Reply Last reply
            0
            • SGaistS SGaist
              delete _qnam;
              _qnam = new QNetworkAccessManager(this);
              // do all the connections.
              
              Q Offline
              Q Offline
              qt_newbee
              wrote on last edited by
              #6

              @SGaist You saved my time. Thanks for the input and my application worked after I have recreated the QNAM object and connected the necessary signals and slots into my current context. Thanks for your support.

              1 Reply Last reply
              0
              • A anshah referenced this topic on

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved