Does QTcpSocket::readAll return immediately like QTcpSocket::write



  • Hi,

    I'm looking for confirmation regarding QTcpSocket::readAll behaviour. In the QIODevice it is stated that :

    bq. Certain subclasses of QIODevice, such as QTcpSocket and QProcess, are asynchronous. This means that I/O functions such as write() or read() always return immediately, while communication with the device itself may happen when control goes back to the event loop.

    My questions is whether this also applies to QTcpSocket::readAll. For example, will QThreadPool::start only be executed when readAll() is finished? Or will readAll() return immediately, in which case how does the data (in this case a QByteArray) end up in my ReadMessageTask (which is a derived class of QRunnable)?

    @QRunnable *readMessageTask = new ReadMessageTask(m_socket.readAll(), this); QThreadPool::globalInstance()->start(readMessageTask);@

    Thanks in advance!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.