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. [SOLVED] QTcpSocket writes data and canReadLine() returns false
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] QTcpSocket writes data and canReadLine() returns false

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.4k 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.
  • francescmmF Offline
    francescmmF Offline
    francescmm
    wrote on last edited by
    #1

    I'm experimenting with QTcpSocket and I have seen that when I write data in one client with the form:
    @socketClient1->write("Line of text");@

    and then, in other client socket I try to do:
    @socketClient2->canReadLine();@

    it returns flase. It does it despite I can read the text with socket->readAll();.

    Any comments?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      devitt
      wrote on last edited by
      #2

      try socketClient1->write("Line of text\n");

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

        Hi,

        "Line of text" is not a line it's missing "\n" to be considered a line

        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
        • francescmmF Offline
          francescmmF Offline
          francescmm
          wrote on last edited by
          #4

          Thanks for the response!

          I imagine that but I preferred to confirm it by someone how knows more, hehehe!

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

            Use the sources francescmm :)

            There's also an example in QIODevice::canReadLine documentation

            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