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::write(QByteArray(.size)) doesn´t fit to signal encryptedBytesWritten(qint64 written)
Forum Updated to NodeBB v4.3 + New Features

QSslSocket::write(QByteArray(.size)) doesn´t fit to signal encryptedBytesWritten(qint64 written)

Scheduled Pinned Locked Moved Unsolved General and Desktop
qsslsocket
1 Posts 1 Posters 696 Views 1 Watching
  • 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.
  • NobodyAtWeekendN Offline
    NobodyAtWeekendN Offline
    NobodyAtWeekend
    wrote on last edited by
    #1

    Hi guys,
    I have a question for you, which costs me already a good amount of time.
    When I sent data by the write function of QSslSocket to an already encrypted connection, the functions returns me exactly the size of the QByteArray I give to the function. So far so good, everything as expected.
    The amount of data is around 66000 bytes in that QByteArray. Sometimes it happens, that the signal is emitted twice, because the whole data wasn´t encrypted/sent yet. I want to detect when the whole data is transmitted and therefore I´ve tried to store the initial number of bytes and subtract the written bytes in the slot (for the encryptedBytesWritten signal) every time it is called. But unfortunately is the total number of bytes written larger than the size of the QByteArray which was given to the QSslSocket::write() function.
    Is there any reason why the numbers differ? Are more bytes written because of some encryption overhead? Can the number of bytes written be calculated on the size of the QByteArray (for all encryption variants which QSslSocket / openSsl offers)?
    Is there maybe another solution how to determine, that all data given to the QSslSocket::write function was sent? I´ve already played around with the functions "encryptedBytesToWrite()" and "bytesToWrite" of the QSslSOcket, but with no success.

    I really hope you can help me. Thanks in advance!

    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