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. Linux embedded device Qt5.3/5.6 QTcpServer does not emit the newConnection() signal,accept() returns UnsupportedSocketOperationError or UnknownSocketError.
Forum Updated to NodeBB v4.3 + New Features

Linux embedded device Qt5.3/5.6 QTcpServer does not emit the newConnection() signal,accept() returns UnsupportedSocketOperationError or UnknownSocketError.

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 3 Posters 1.6k Views 1 Watching
  • 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #4

    Hi,

    Are you trying to connect two applications built with different versions of Qt ?

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

    L 1 Reply Last reply
    0
    • SGaistS SGaist

      Hi,

      Are you trying to connect two applications built with different versions of Qt ?

      L Offline
      L Offline
      lanlan
      wrote on last edited by lanlan
      #5

      @SGaist Hi,thank you for the help.

      Qt example code on Linux embedded device as server(my own code is the same).Network assist tool on PC as client.At first,I thought there was something wrong with my implementation,so I tried official example code.Then i tried running two versions Qt of the Server(Example code),both of them didn't work.

      I also used QT_DEBUG_PLUGINS=1,the result is here:

      Found metadata in lib /opt/5.6armQt/plugins/bearer/libqnmbearer.so, metadata=
      {
      "IID": "org.qt-project.Qt.QBearerEngineFactoryInterface",
      "MetaData": {
      "Keys": [
      "networkmanager"
      ]
      },
      "className": "QNetworkManagerEnginePlugin",
      "debug": true,
      "version": 329219
      }

      It seems to be correct.

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

        Can you run the server on your desktop and the client on your device ? Does it work ?

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

        L 1 Reply Last reply
        0
        • SGaistS SGaist

          Can you run the server on your desktop and the client on your device ? Does it work ?

          L Offline
          L Offline
          lanlan
          wrote on last edited by lanlan
          #7

          @SGaist
          I get your point,but I am sure the program is ok.Because it can run on other devices.Maybe the problem caused by linux kernel version,i will deep into Qt source code.

          I debugged source code,log is here:

          QTcpServer::QTcpServer(0xbe9d1b04)
          QTcpServer::listen(8001, "192.168.20.62") == true (listening on port 8001)
          pendingConnections.count(): 0
          maxConnections: 30
          QNativeSocketEngine::accept() in !
          Unix QNativeSocketEnginePrivate::nativeAccept()!
          QT_THREADSAFE_CLOEXEC!
          do accept4 fd:-1!
          acceptedDescriptor: -1
          errno: 94
          descriptor: -1
          myError: QAbstractSocket::UnknownSocketError

          I wonder why it uses accept4() instead of accept().Amazing....

          So,let me find the point....

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lanlan
            wrote on last edited by
            #8

            I used accpet() instead.

            I dont know the root cause the problem.
            And I can't predict what the consequences of this modification will be.

            But the code works fine.

            So I keep the question and wait for the big one to solve.

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

              What kernel version are you running ?
              Any parameter specific to that board ?

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

              L 1 Reply Last reply
              0
              • SGaistS SGaist

                What kernel version are you running ?
                Any parameter specific to that board ?

                L Offline
                L Offline
                lanlan
                wrote on last edited by lanlan
                #10

                @SGaist
                Hi,
                kernel 3.2.0,using the vendor's kernel image.So i dont know the details.

                Only know,when using accept(), must specify the length of the third parameter,can not be null or 0(Qt source is 0).Otherwise, it also doesnt work.

                Source code is here(qnativesocketengine_unix.cpp +561):
                int acceptedDescriptor = qt_safe_accept(socketDescriptor, 0, 0);

                I almost learned every post related to the issue on the forum, and there is no solution.So i think maybe its a bug of kernel or Qt.It may also be that my ability is not good enough to find the point.

                Whatever,i have no time to continue it,So the problem is "solved", and waiting for the big one.

                Btw,if you have the ability to send questions to the Qt Group, it may help more guys.
                :)

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

                  You can ask the question yourself directly, it's not a closed group ;-)

                  That said, where exactly did you saw that issue with the size in Qt's code ?
                  Did you check whether more recent versions of Qt are still affected ?

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

                  L 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    You can ask the question yourself directly, it's not a closed group ;-)

                    That said, where exactly did you saw that issue with the size in Qt's code ?
                    Did you check whether more recent versions of Qt are still affected ?

                    L Offline
                    L Offline
                    lanlan
                    wrote on last edited by
                    #12

                    @SGaist

                    Hi,
                    Yes,I modified the Qt's code(qnativesocketengine_unix.cpp +561).
                    And my code just ran on version 5.3/5.6.

                    Thanks for the reply.

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

                      In what way did you modify the code ?

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

                      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