Important: Please read the Qt Code of Conduct -

QSslSocket error without sslErrors emited

  • Hello,

    i've got a QTcpServer which listens on a port. I've implemented the oncommingConnection function like that:

    SslConnection *pSsl = new SslConnection();
       QObject::connect(pSsl, SIGNAL(sslErrors(QList<QSslError>)),
                        this, SLOT(sslError(QList<QSslError>)));
       QObject::connect(pSsl, SIGNAL(error(QAbstractSocket::SocketError)),
                        this, SLOT(error(QAbstractSocket::SocketError)));
       qDebug() << "SslError:" << pSsl->sslErrors();
       delete pSsl;

    SslConnection is just a QSslSocket, nothing special in it yet. Both slots just print the errors using qDebug(), nothing special in them too.
    The error from the error()-slot i receive is:

    SocketError: QAbstractSocket::SocketTimeoutError
    SocketError: QAbstractSocket::SocketError( 13 )

    the SocketError(13) is a


    but my sslError-slot doesn't receive any error at all. The qDebug() i added at the end prints an empty list.
    Why does the QAbstractSocket tell me about an Ssl Error while the QSslSocket doesn't provide me further informations or errors at all?

    Maybe helpful:

    • Qt 5.4 on Windows
    • OpenSSL 1.0.2a
    • QSslSocket::supportsSsl() returns true

  • It's because Qt (or rather QSslSocket) closes the connection immediately after emitting the error() signal.