Important: Please read the Qt Code of Conduct -

Give function a deadline?

  • I'm working on some communication with a RS232-port and I'm using QSerialPort to communicate between the client and the emulator I'm running. Everything is working fine, data is flowing nicely between the two.

    My problem, however, is that I want to make sure that the process of reading data from the emulator should take 100ms or less; or else return a NAK. Currently I write, flush and then wait for readyRead to get all the data and then I manipulate that data as I see fit and then I return an ACK back to the emulator, but I need that timeout operation. How can I achieve this?

    In advance, thanks!

  • Hi! bool QSerialPort::waitForReadyRead(int msecs = 30000) has a built-in timeout. Or do you mean something else?

  • Hm, I'll try that out. Thanks! :)

Log in to reply