Congratulations to our 2022 Qt Champions!

[SOLVED]QAbstractSocket::disconnected() signal also emitted when error(..) signal is emitted ?

  • The documentation of QAbstractSocket only states this on the subject:
    [quote] If the remote host closes the connection, QAbstractSocket will emit error(QAbstractSocket::RemoteHostClosedError), during which the socket state will still be ConnectedState, and then the disconnected() signal will be emitted.

    So can I expect the disconnected() signal to be always emitted when the error(QAbstractSocket::SocketError) signal is emitted ?

  • Hi,

    disconnected() is emitted each time socket goes to UnconnectedState from ConnectedState; alse if you call disconnect().

    error() is emitted only when system detect an error.

    This means that on error you receive error() and disconnected()

Log in to reply