Hi. I have a QTcpScocket whose readyReady() signal is connected to a slot that handles it.
*Outside* of the scope of said slot I have another method that writes to the socket and then I call waitForReadyRead() in this manner
Qt Code:
m_tcpSocket->write((char *)buffer, bufferSize); m_tcpSocket->waitForReadyRead(5000);To copy to clipboard, switch view to plain text mode
because I need that particular code block to be blocking until I get a response.
Problem is that if I use the waitForReadyRead method, it never re-emits the signal so that the slot can handle the incoming data. If I remove the waitForReadyRead, it works just fine, but it is non-blocking, so the tcpSocket just writes a second message without waiting for the reply to the first one.
Reading the documentation, it says that
If called from within a slot connected to the readyRead() signal, readyRead() will not be reemitted., which is not my case. I am NOT calling waitForReadyRead from within a slot. And I understand from that sentence that, if not called from within a slot, it will re-emit the signal.
I do not wish to call the slot as a method right after the waitForReadyRead(), it just doesn't seem appropiate.
Maybe I actually need to re-implent the waitForReadyRead() to re-emit the signal?
Any ideas on this issue?
Additional info: waitForReadyRead() is returning true. I don't know if this is useful or not, but better safe than sorry.
Bookmarks