Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [Qt Message] exception on 3 [will close the socket handle - hack]

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

Scheduled Pinned Locked Moved Mobile and Embedded
8 Posts 3 Posters 5.4k 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.
  • H Offline
    H Offline
    hisong1988
    wrote on last edited by
    #1

    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
    0
    • B Offline
      B Offline
      blex
      wrote on last edited by
      #2

      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
      0
      • H Offline
        H Offline
        hisong1988
        wrote on last edited by
        #3

        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
        0
        • B Offline
          B Offline
          blex
          wrote on last edited by
          #4

          [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
          0
          • H Offline
            H Offline
            hisong1988
            wrote on last edited by
            #5
            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
            0
            • B Offline
              B Offline
              blex
              wrote on last edited by
              #6

              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
              0
              • J Offline
                J Offline
                jonexi
                wrote on last edited by
                #7

                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
                0
                • H Offline
                  H Offline
                  hisong1988
                  wrote on last edited by
                  #8

                  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
                  0

                  • Login

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