Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. readyread

    Log in to post
    • All categories
    • Narutoblaze

      Unsolved QTcpSocket Read/Write correctly & reliable
      General and Desktop • qtcpsocket qdatastream readyread qiodevice qtcpserver • • Narutoblaze

      8
      0
      Votes
      8
      Posts
      49
      Views

      JonB

      @Narutoblaze
      Your code/algorithm is incorrect. This is basic coding, please study what your code does. You "actively" encourage reading across file boundaries, i.e. what you call "too much").

      You (seem to) start by setting size to the total number of bytes expected for the file. Then you call read(buffer, size);. But when that returns with fewer bytes than size you still call it again next time round asking it to read up to size further bytes. This can/will exceed the number of bytes in the first file. You obviously need to reduce what size you pass to read() accordingly on subsequent calls. And then be careful what you compare in your if (... || numReadTotal == size). Adjust your code however to make it right.

      I previously said that the whole synchronous approach of repeatedly calling waitForReadyRead() in a loop is not the event-driven way to do things. Allow bytes to arrive in repeated readyRead() signals asynchronously instead.

    • M

      Unsolved Receive Data QserialPort
      General and Desktop • qt creator c++ qserialport readyread • • manel.sam

      10
      0
      Votes
      10
      Posts
      266
      Views

      M

      @JonB @mrjj

      It's coming back to me. I once had the same problem with an IMU sensor that I could not solve under windows.

      But once under linux with the same code, I receive the data perfectly.

      Same thing, I just tested under linux for the GPS, I receive the data but not under Windows.

      To this day I don't know where the problem comes from

    • I

      Unsolved readyRead() signal is working strange
      Qt for MCUs • qserialport readyread serial port rs485 • • IRBaboon

      14
      0
      Votes
      14
      Posts
      1194
      Views

      Crawl.W

      @IRBaboon If your PC have no obvious lagging, my issue is an error direction. Here are some ideas you can try:

      read help doc seriously or test one other poeple's credible demo on your devie, is it possible to call it incorrectly?(for serial device, It is difficult for others to run your demo) try the lastest verion of QT
    • V

      Solved problem with QLocalSocket sending continues data to QLocalServer
      General and Desktop • qlocalsocket qlocalserver readyread • • Venkateswaran

      14
      0
      Votes
      14
      Posts
      1287
      Views

      JonB

      @VRonin said in problem with QLocalSocket sending continues data to QLocalServer:

      This is not correct.

      Damn, and sorry! I thought that it had said that, but not. I may have confused with

      readyRead() is not emitted recursively; if you reenter the event loop or call waitForReadyRead() inside a slot connected to the readyRead() signal, the signal will not be reemitted (although waitForReadyRead() may still return true).

    • F

      Solved QSerialPort Issue:: reading an undesired write message.
      General and Desktop • qserialport readyread read serial write issue • • Factao

      4
      0
      Votes
      4
      Posts
      693
      Views

      F

      @aha_1980 I'm expecting to read and write data with a serial port, but, for some reason, the data sent by my pc is also read by my pc, so the problems is that the data sent is somehow triggering the readyRead signals.

      @J-Hilk I noticed that ,effectively, the echo wasn't turned off on the pi. For whatever reason, it completely broke my programs when I'm turning it of, so I'm going to install qt and try again on the pi before calling it a win.

    • K

      Unsolved QTcpSocket never emits readyRead when connected
      General and Desktop • qtcpsoket qnetworkpoxy readyread • • KirstenS

      6
      0
      Votes
      6
      Posts
      2085
      Views

      SGaist

      There's one other thing that is strange, the documentation of netcat explicitly state that you should not use -p and -l together. So what exactly are you connecting to ?

    • McLion

      Unsolved readyRead of a socket in a seperate thread
      General and Desktop • socket thread readyread • • McLion

      6
      0
      Votes
      6
      Posts
      2628
      Views

      McLion

      @VRonin
      Server is on a different machine in the LAN and the software is not from me.
      I only implement the client side.

    • Basti46

      Solved QSerialPort read string with "readAll()"
      General and Desktop • qserialport qiodevice readline readyread • • Basti46

      11
      0
      Votes
      11
      Posts
      20432
      Views

      mrjj

      @Basti46
      Good work!
      :)

    • Q

      Solved QProcess in different thread does not send readyRead() signal (whole concise code pasted)
      General and Desktop • qprocess qthread readyread • • qt_fan_4k

      3
      0
      Votes
      3
      Posts
      2864
      Views

      Q

      @Wieland
      Thank you so much, Wieland. You're 100% right, and I was not lucky enough :)
      After moving the sending of finish signal elsewhere, everything goes fine.

    • O

      Unsolved readyRead() with multiple streams
      General and Desktop • readyread • • OliverBJ01

      2
      0
      Votes
      2
      Posts
      1723
      Views

      jsulm

      You can use two different slots or use the same slot but check what the sender is (you get pointer to the sender calling sender() in the slot).

    • ?

      Solved QSerialPort::readyRead() not fired any more after QSerialPort::close() and QSerialPort::open()
      General and Desktop • readyread qserialport signal & slot • • A Former User

      12
      0
      Votes
      12
      Posts
      7565
      Views

      ?

      @kuzulis: Thanks for the hint to update to 5.6.0! Since it is some effort to update the embedded installation on the Qt target, I first tried the terminal example with 5.3.2, just adding /dev/ttyGS0 as a serial interface manually. Interestingly, transmission worked very well even after re-loading the g_serial driver.

      So i had a look at my own qt program, again. First, very strangely, transmission didn't work at all, but after restarting the embedded system, doing a "clean all" on the project and built it again, everything now works perfectly also in my program... Very strange...

      So I hope there has only happened something in the build directory and now everything is solved doing the clean and re-building...

      Everybody, thanks a lot for your help!

      Greetings,

      Markus

      PS: I also had to update my desktop qt installation for receiving the terminal example files (didn't find the bundled files on the qt site and my installation didn't provide them, also), but I guess this didn't have an effect on my cross-compiled application...

    • L

      I miss some bytes from Serial Port using Qt
      General and Desktop • qserialport arduino readyread threading • • LostInSpace

      9
      0
      Votes
      9
      Posts
      4250
      Views

      Hamed

      #2 is wasteful way indeed!
      but in low baud rates it will help, but in this case I don't think this is a low baud rate.

      EDIT : I said for example 1ms, you really don't need it this fast, it depends on the frequency of getting bytes, for example for 20Hz you will have 20bytes every second which means you need a timer with at least 50ms refresh time and of course you read from serial port in asynchronous way then you can't 100% trust this way to read byte by byte, So as @JKSH said you better don't use this way if you don't have a specific reason.