Search code examples
qtbyteqnetworkaccessmanager

How to download by block with Qt?


For many reasons i need to download file by piece of 1024 byte.

I find nothing in QnetworkAccessManager. I can not use the "header technic" because my server don't support it.

I call header technic, the tecnic who send stuff like "Content-Range: bytes 21010-47000/47022" in the header of http request


Solution

  • Use a QTcpSocket instead and call QTcpSocket::setReadBufferSize() with an appropriate value. Then you won't be able to read bigger chunks than the size of the buffer you set.