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. Does QTcpSocket::readAll return immediately like QTcpSocket::write

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

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 893 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.
  • T Offline
    T Offline
    t3685
    wrote on last edited by
    #1

    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!

    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