[Qt-interest] Problem using QNetworkAccessManager/QNetworkReply for large file download
Markus Goetz
Markus.Goetz at nokia.com
Wed Feb 17 10:09:22 CET 2010
Hi,
ext Mandeep Sandhu wrote:
> 1) Whenever I read BUFSIZE in the readyRead signal, I'm seeing that I
> get LESS number of bytes than BUFSIZE! I get around 70K as size of the
> QByteArray. Is this expected?
>
Yes. readyRead() is emitted as soon as Qt knows about any data
available. You would have to check bytesAvailable() then.
> 2) I've set the read buffer size to 128K and expect Qt to "throttle"
> the download whenever the read buffer gets full. I keep getting the
> readyRead signal till the buffer is full (QIODevice::bytesAvailable =
> BUFSIZE) and then after sometime the download completes (verified from
> webserver log which shows the full file is served). Does this mean
> that Qt actually downloads the _complete_ file and does not throttle
> at the network level? I'm asking this because the file download works
> for small files, but the program seg faults for a large file (eg the
> file i tested was 900MB). The webserver log shows whatever bytes that
> were served before the connection was close as a result of the program
> crashing.
>
> Has anybody experienced similar issue?
>
> I've found a bug that fixes something similar, though it mentions only
> MAC and Windows as the affected platforms:
>
> http://bugreports.qt.nokia.com/browse/QTBUG-6276?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel
>
> It's also fixed in Qt 4.6! :(
>
>
Yes, there have been some more fixes in 4.6 regarding that. It should
work there now with 4.6.2. Please consider upgrading.
Markus
More information about the Qt-interest-old
mailing list