Qt World Summit: Submit your Presentation

QSslSocket behavior

  • Hello all,
    I'm having a very strange behavior with QSslSocket: I'm developing a client/server application over TCP (application protocol is proprietary). I'm using RSA for public key protocol used for authentication, AES-128 for symmetric cipher and SHA for hash.

    My protocol is using several ports: 2 of them are used for control (small messages, less than 150 chars most of the time), a last one is used for file transfer.

    Everything works fine as long as I'm using 4K length RSA keys.

    When decreasing RSA key length (1024/2048 instead of 4096), file transfer does not work any more. Small messages exchange on other ports is still ok though.

    When I'm saying that file transfer does not work, it means that onReadyRead() slot of QSslSocket is never called, not even once. I checked with Wireshark that data was actually sent and actually arrived on server, so issue is inside Qt itself.

    Any idea of what is going on ?

    Thanks in advance

    • looks like onReadyRead() slot is not called while some data are available for reading: this looks like a Qt bug !
      For me it happened with Qt4.7.4, need to check if this may also happen with newer versions...

    A workaround consists in forcing 1st call to onReadyRead() slot after waiting for available bytes to be there:

    while (!_socketClient->bytesAvailable())


    Then for following data chunks, Qt fortunately calls onReadyRead() as expected...
    For information I'm on Windows 32-bits, but this may well happen also on Linux. To be checked also...

Log in to reply