Important: Please read the Qt Code of Conduct -

QTcpSocket with signal capability

  • Hello:

    I like to know if there is a way for QTcpSocket to automatically (i.e. not polling it
    periodically using bytesAvailable() member function )
    sends a signal when it has receive data from remote host.
    So, I am looking for a signal function in QTcpSocket.

    I did not see any documentation on signals emitted (when its buffer has data) by QTcpSocket.
    I may have miss one. if there is any.

  • You should be able to connect to the readyRead() signal. It might originate from QIODevice, which means you don't see it in the QTcpSocket documentation.

  • Moderators

    QTcpSocket is a QAbstractSocket which is a QIODevice which has a "readyRead() signal":

  • As a general rule: if you find that some method, signal, property... that you think should obviously be in a class isn't in the documentation for that class, you should either browse the documentation of the superclasses, or just click the "List of all members, including inherited members" link. There is a good chance you'll find what you are looking for in (abstract) base class.

Log in to reply