QSslSocket error without sslErrors emited
-
wrote on 6 May 2015, 15:04 last edited by onek24 5 Nov 2015, 07:56
Hello,
i've got a QTcpServer which listens on a port. I've implemented the oncommingConnection function like that:
SslConnection *pSsl = new SslConnection(); if(pSsl->setSocketDescriptor(socketDescriptor)) { QObject::connect(pSsl, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslError(QList<QSslError>))); QObject::connect(pSsl, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError))); pSsl->startServerEncryption(); pSsl->waitForEncrypted(2000); qDebug() << "SslError:" << pSsl->sslErrors(); } else { 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
QAbstractSocket::SslHandshakeFailedError
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
-
wrote on 2 Sept 2016, 06:53 last edited by marcbf 9 Feb 2016, 06:53
It's because Qt (or rather QSslSocket) closes the connection immediately after emitting the error() signal.