Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSslSocket error without sslErrors emited

QSslSocket error without sslErrors emited

Scheduled Pinned Locked Moved General and Desktop
qsslsocketqsslerrorsocketerrorssl failedsslqt 5.4openssl
2 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    onek24
    wrote on last edited by onek24
    #1

    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
    1 Reply Last reply
    0
    • M Offline
      M Offline
      marcbf
      wrote on last edited by marcbf
      #2

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved