Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. network in qt6

network in qt6

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 638 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by A Former User
    #1

    Hello,
    I have been following network learning, but there was no success. I use qt 6.5 LTS along with qt creator 10.0.0 on Windows 11. Here are two programs.
    client
    server
    The error I get is

    qt.core.qobject.connect: QObject::connect: No such signal QTcpSocket::error(QAbstractSocket::SocketError) in ..\user.cpp:48
    qt.core.qobject.connect: QObject::connect:  (receiver name: 'user')
    

    Your help is appreciated

    Pl45m4P 1 Reply Last reply
    0
    • ? A Former User

      Hello,
      I have been following network learning, but there was no success. I use qt 6.5 LTS along with qt creator 10.0.0 on Windows 11. Here are two programs.
      client
      server
      The error I get is

      qt.core.qobject.connect: QObject::connect: No such signal QTcpSocket::error(QAbstractSocket::SocketError) in ..\user.cpp:48
      qt.core.qobject.connect: QObject::connect:  (receiver name: 'user')
      

      Your help is appreciated

      Pl45m4P Offline
      Pl45m4P Offline
      Pl45m4
      wrote on last edited by Pl45m4
      #2

      @Vahid-Ajallooeian said in network in qt6:

      qt.core.qobject.connect: QObject::connect: No such signal QTcpSocket::error(QAbstractSocket::SocketError) in ..\user.cpp:48
      qt.core.qobject.connect: QObject::connect: (receiver name: 'user')

      This error comes from a wrong or failed connect statement.

      It's sad that "learning examples" are still using the macro style connection and not the function based connect statement.
      Then code with failed connections wouldn't even compile.

      So back to the issue, which has the same origin: old code.
      The example was probably made for Qt4 or an early Qt5.

      Checking line 48 in user.cpp from client:

      connect(m_pClientsocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(displayError(QAbstractSocket::SocketError)));
      

      Since Qt 5.15 onwards there is no error(QAbstractSocket::SocketError) signal in QAbstractSocket anymore.
      There is an error() function, which returns the last error, but the signal to do what the code should do, is called errorOccurred(QAbstractSocket::SocketError)

      • https://doc.qt.io/qt-5/qabstractsocket.html#errorOccurred
      • https://doc.qt.io/qt-6/qabstractsocket.html#errorOccurred
      • https://doc.qt.io/qt-5/qabstractsocket.html#error

      The solution could look like this:

      connect(m_pClientsocket, &QTcpSocket::errorOccurred, this, &user::displayError);
      

      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      ? 1 Reply Last reply
      1
      • Pl45m4P Pl45m4

        @Vahid-Ajallooeian said in network in qt6:

        qt.core.qobject.connect: QObject::connect: No such signal QTcpSocket::error(QAbstractSocket::SocketError) in ..\user.cpp:48
        qt.core.qobject.connect: QObject::connect: (receiver name: 'user')

        This error comes from a wrong or failed connect statement.

        It's sad that "learning examples" are still using the macro style connection and not the function based connect statement.
        Then code with failed connections wouldn't even compile.

        So back to the issue, which has the same origin: old code.
        The example was probably made for Qt4 or an early Qt5.

        Checking line 48 in user.cpp from client:

        connect(m_pClientsocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(displayError(QAbstractSocket::SocketError)));
        

        Since Qt 5.15 onwards there is no error(QAbstractSocket::SocketError) signal in QAbstractSocket anymore.
        There is an error() function, which returns the last error, but the signal to do what the code should do, is called errorOccurred(QAbstractSocket::SocketError)

        • https://doc.qt.io/qt-5/qabstractsocket.html#errorOccurred
        • https://doc.qt.io/qt-6/qabstractsocket.html#errorOccurred
        • https://doc.qt.io/qt-5/qabstractsocket.html#error

        The solution could look like this:

        connect(m_pClientsocket, &QTcpSocket::errorOccurred, this, &user::displayError);
        
        ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        Dear @Pl45m4
        Thank you for your follow-up.
        The terminal error has gone, but messages are not transmitted between the server and the client.

        Pl45m4P 1 Reply Last reply
        0
        • ? A Former User

          Dear @Pl45m4
          Thank you for your follow-up.
          The terminal error has gone, but messages are not transmitted between the server and the client.

          Pl45m4P Offline
          Pl45m4P Offline
          Pl45m4
          wrote on last edited by
          #4

          @Vahid-Ajallooeian said in network in qt6:

          The terminal error has gone, but messages are not transmitted between the server and the client.

          Debug and check what happens.
          I would also check your whole project and compare it with the Qt6.5 documentation to see if there is more deprecated stuff


          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

          ~E. W. Dijkstra

          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