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 Write not Working
Qt 6.11 is out! See what's new in the release blog

QTcpSocket Write not Working

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 628 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.
  • E Offline
    E Offline
    Enrique_01
    wrote on last edited by
    #1

    Hello, I'm new to QT and working on a project to better learn. In the following code socket is a QTcpSocket object. The top green checkmark works at intended but the bottom does not at all. Are the parameters I'm passing on the bottom method incorrect somehow?

    ![Code Snippet](Capture.PNG image url)

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #2

      concatenation of strings from char arrays is iffy. Are NICK and TARGET arrays or strings?

      Maybe avoid the problem completely by assigning the first token and then using std::string.append()

      The dystopian literature that served as a warning in my youth has become an instruction manual in my elder years.

      E 1 Reply Last reply
      0
      • Kent-DorfmanK Kent-Dorfman

        concatenation of strings from char arrays is iffy. Are NICK and TARGET arrays or strings?

        Maybe avoid the problem completely by assigning the first token and then using std::string.append()

        E Offline
        E Offline
        Enrique_01
        wrote on last edited by Enrique_01
        #3

        @Kent-Dorfman said in QTcpSocket Write not Working:

        Maybe avoid the problem completely by assigning the first token and then using std::string.append()

        They're strings taken from the following method.
        Capture.PNG

        jsulmJ 1 Reply Last reply
        0
        • E Enrique_01

          @Kent-Dorfman said in QTcpSocket Write not Working:

          Maybe avoid the problem completely by assigning the first token and then using std::string.append()

          They're strings taken from the following method.
          Capture.PNG

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Enrique_01 Please post code as text, not screen-shots.
          In what way does the second approach not work? What happens?
          Did you check the resulting strings you're sending?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • E Offline
            E Offline
            Enrique_01
            wrote on last edited by
            #5

            Figured it out. I ran into a similar issue a while ago...should have realized it sooner. The server only takes UTF-8 encoding for commands.
            Capture.PNG

            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