Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[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.
    [/quote]

    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