Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [Qt Message] exception on 3 [will close the socket handle - hack]

    Mobile and Embedded
    3
    8
    4919
    Loading More Posts
    • 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.
    • H
      hisong1988 last edited by

      I got such an exception above. It seems the app will close the socket handle instead of closing by me.

      I use the get() function of QNetworkAccessManager to get a url. and then deal with the data the url return.
      @
      void MainWindow::on_cityComboBox_currentIndexChanged(int index)
      {
      QTextCodec::setCodecForCStrings(QTextCodec::codecForName("GB2312"));
      QString url="http://www.google.com/ig/api?hl=zh_cn&weather=";
      QString localPlace=ui->cityComboBox->currentText();
      ui->locaPlace->setText(localPlace);//add the place to the label-localPlace
      url.append(localPlace);
      manager =new QNetworkAccessManager(this);
      manager->get(QNetworkRequest(QUrl(url)));
      connect(manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(replyFinish(QNetworkReply*)));

      }
      @

      I connect my Nokia 5230 to my computer and the app run on it.
      It seems work well on it when my app is running.But when I close the app,the application output window come to such "[Qt Message] exception on 3 [will close the socket handle - hack]"

      Any one meet such a problem? Any suggestion?

      I am still searching for....

      1 Reply Last reply Reply Quote 0
      • B
        blex last edited by

        Is socket closed in your code?

        Try to locate the message in Qt sources and set the break-point on it - this may help you to understand what happens.


        Oleksiy Balabay

        1 Reply Last reply Reply Quote 0
        • H
          hisong1988 last edited by

          Thanks for your reply.

          How to close the socket?

          I only use the QNetworkAccessManager and QNetworkReply of the network classes.
          As said above,I only use the get() function of QNetworkAccessManager to get a url,and deal with the data that the url reply with the QNetworkReply.

          and I don't know how to locate the message,either because I don't know how the problem appeared

          I am still searching for....

          1 Reply Last reply Reply Quote 0
          • B
            blex last edited by

            [quote author="hisong1988" date="1290359270"]How to close the socket?[/quote]

            Quote from Qt documentation:

            Note: After the request has finished, it is the responsibility of the user to delete the QNetworkReply object at an appropriate time. Do not directly delete it inside the slot connected to finished(). You can use the deleteLater() function.

            Maybe, QNetworkAccessManager also should be deleted on application close, I am not sure.

            [quote author="hisong1988" date="1290359270"]and I don't know how to locate the message,either because I don't know how the problem appeared[/quote]

            Just search all files in the Qt sources - it is Open Source benefit :-)


            Oleksiy Balabay

            1 Reply Last reply Reply Quote 0
            • H
              hisong1988 last edited by

              Sorry to reply to you so late.
              
               I used the deletelater() funtion in the slot function. But it dos not work.I know the deletelater() function is the release the data I get from the reply.  I also try to use the close() function too, but with the same result.
              
               The network of the app runs well on the device,but I really want to find the cause of the problem.
              

              I am still searching for....

              1 Reply Last reply Reply Quote 0
              • B
                blex last edited by

                To find the cause of the problem try to follow my second suggestion: locate in the Qt or Qt Mobility sources the string from the message window and set breakpoint at that place.

                Good Luck


                Oleksiy Balabay

                1 Reply Last reply Reply Quote 0
                • J
                  jonexi last edited by

                  I've faced same problem. It looks like qt network access backend doesn't handle sockets properly.

                  I suppose root cause is same as reported in:
                  http://bugreports.qt.nokia.com/browse/QTBUG-12686

                  1 Reply Last reply Reply Quote 0
                  • H
                    hisong1988 last edited by

                    I don't really understand the root cause with the link you give.

                    Thanks very much. I hope the exception will be solved by next Qt version.

                    I am still searching for....

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post