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. Qtcpsocket

Qtcpsocket

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 996 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.
  • S Offline
    S Offline
    satyanarayana143
    wrote on last edited by satyanarayana143
    #1

    I am using Qt5.14.1 for andriod
    m_pTcpSocket->connectToHost(m_sServerIpAddress,m_nServerPort);

    audiotransmitter.cpp:439:69: error: too few arguments to function call, expected at least 3, have 2
    qabstractsocket.h:152:5: note: 'connectToHost' declared here

    this error is getting in andriod Qt5.14.1

    J.HilkJ 1 Reply Last reply
    0
    • S satyanarayana143

      I am using Qt5.14.1 for andriod
      m_pTcpSocket->connectToHost(m_sServerIpAddress,m_nServerPort);

      audiotransmitter.cpp:439:69: error: too few arguments to function call, expected at least 3, have 2
      qabstractsocket.h:152:5: note: 'connectToHost' declared here

      this error is getting in andriod Qt5.14.1

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @satyanarayana143 a assume ptcpSocket is not a QTcpSocket, because than connectToHost would have a default parameter as 3rd one

      QIODevice::ReadWrite usually.


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      1
      • S Offline
        S Offline
        satyanarayana143
        wrote on last edited by
        #3

        @J-Hilk said in Qtcpsocket:

        QIODevice::ReadWrite

        i has given like this QIODevice::ReadWrite

        but i am getting error openmodeflag cannot convert to openmode

        J.HilkJ 1 Reply Last reply
        0
        • S satyanarayana143

          @J-Hilk said in Qtcpsocket:

          QIODevice::ReadWrite

          i has given like this QIODevice::ReadWrite

          but i am getting error openmodeflag cannot convert to openmode

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @satyanarayana143
          more information!

          What's the definition of connectToHost in audiotransmitter.h?


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            satyanarayana143
            wrote on last edited by satyanarayana143
            #5

            Qtcpsocket

            when i am giving QIODevice::ReadWrite i am getting below error

            audiotransmitter.cpp:439:70: error: no viable conversion from 'QIODevice::OpenModeFlag' to 'QIODevice::OpenMode' (aka 'QFlagsQIODevice::OpenModeFlag')
            qflags.h:89:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'QIODevice::OpenModeFlag' to 'const QFlagsQIODevice::OpenModeFlag &' for 1st argument
            qflags.h:89:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'QIODevice::OpenModeFlag' to 'QFlagsQIODevice::OpenModeFlag &&' for 1st argument
            qabstractsocket.h:152:80: note: passing argument to parameter 'mode' here

            J.HilkJ 1 Reply Last reply
            0
            • S satyanarayana143

              Qtcpsocket

              when i am giving QIODevice::ReadWrite i am getting below error

              audiotransmitter.cpp:439:70: error: no viable conversion from 'QIODevice::OpenModeFlag' to 'QIODevice::OpenMode' (aka 'QFlagsQIODevice::OpenModeFlag')
              qflags.h:89:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'QIODevice::OpenModeFlag' to 'const QFlagsQIODevice::OpenModeFlag &' for 1st argument
              qflags.h:89:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'QIODevice::OpenModeFlag' to 'QFlagsQIODevice::OpenModeFlag &&' for 1st argument
              qabstractsocket.h:152:80: note: passing argument to parameter 'mode' here

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @satyanarayana143
              very strange, shouldn't bee needed, but add #include <QIODevice> in the file, where you wrote QIODevice::ReadWrite


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                satyanarayana143
                wrote on last edited by
                #7

                i added
                #include <QIODevice>

                also getting same error

                JonBJ 1 Reply Last reply
                0
                • S satyanarayana143

                  i added
                  #include <QIODevice>

                  also getting same error

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #8

                  @satyanarayana143
                  May I suggest you actually show the line where you are using QIODevice::ReadWrite, and generates the error, rather than just stating you are using it?

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    satyanarayana143
                    wrote on last edited by
                    #9
                      QTcpSocket *m_pTcpSocket=nullptr;
                    
                        m_pTcpSocket = new QTcpSocket(this);
                    
                        m_pTcpSocket->connectToHost(m_sServerIpAddress,m_nServerPort);    // In this line  i am getting error 
                    

                    error: too few arguments to function call, expected at least 3, have 2
                    qabstractsocket.h:152:5: note: 'connectToHost' declared here

                    for andriod Qt5.14.1

                    JonBJ 1 Reply Last reply
                    0
                    • S satyanarayana143
                        QTcpSocket *m_pTcpSocket=nullptr;
                      
                          m_pTcpSocket = new QTcpSocket(this);
                      
                          m_pTcpSocket->connectToHost(m_sServerIpAddress,m_nServerPort);    // In this line  i am getting error 
                      

                      error: too few arguments to function call, expected at least 3, have 2
                      qabstractsocket.h:152:5: note: 'connectToHost' declared here

                      for andriod Qt5.14.1

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #10

                      @satyanarayana143
                      So if that is in reply to me, that shows me where you are using QIODevice::ReadWrite, does it?

                      when i am giving QIODevice::ReadWrite i am getting below error

                      audiotransmitter.cpp:439:70: error: no viable conversion from 'QIODevice::OpenModeFlag' to 'QIODevice::OpenMode' (aka 'QFlagsQIODevice::OpenModeFlag')
                      qflags.h:89:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'QIODevice::OpenModeFlag' to 'const QFlagsQIODevice::OpenModeFlag &' for 1st argument
                      qflags.h:89:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'QIODevice::OpenModeFlag' to 'QFlagsQIODevice::OpenModeFlag &&' for 1st argument
                      qabstractsocket.h:152:80: note: passing argument to parameter 'mode' here

                      Are you getting this or not? Would you like us to look at it or not?

                      From https://code.woboq.org/qt5/qtbase/src/network/socket/qabstractsocket.h.html, at lines 152/153, I see

                          virtual void connectToHost(const QString &hostName, quint16 port, OpenMode mode = ReadWrite, NetworkLayerProtocol protocol = AnyIPProtocol);
                          virtual void connectToHost(const QHostAddress &address, quint16 port, OpenMode mode = ReadWrite);
                      

                      That means you should not be getting
                      error: too few arguments to function call, expected at least 3, have 2

                      You might like to verify what you have at those lines in the qabstractsocket.h you have. Is there any chance you have more than one copy of this file somewhere? You might like to copy & paste here the lines you have there, so that we really can see how it could produce that error message?

                      You might like to show us line #439 of audiotransmitter.cpp. But I guess that is the
                      m_pTcpSocket->connectToHost(m_sServerIpAddress,m_nServerPort);
                      line you are showing us won't compile?

                      1 Reply Last reply
                      3

                      • Login

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