[Qt-interest] Qt-interest Digest, Vol 10, Issue 209
Info
info at misafe.com
Wed Sep 30 17:56:01 CEST 2009
Thanks, that's what I'm attempting today but running into a few issues.
My current method passes a QIODevice * to the post() method of
QNetworkAccessManager, the QIODevice being a QBuffer, this works very
well for my situation so I figured I could create a QIODevice subclass
which contained a QBuffer and just delay the reading in the readData()
virtual function to achieve the throttling.
Unfortunately this has not been quite as straight forward as I'd
hoped. My QIODevice subclass implements the following functions:
qint64 readData(char * data, qint64 maxSize);
qint64 writeData(const char * data, qint64 maxSize);
bool atEnd() const;
qint64 bytesAvailable() const;
qint64 bytesToWrite() const;
bool canReadLine() const;
void close();
bool isSequential() const;
bool open(OpenMode mode);
qint64 pos() const;
bool reset();
bool seek(qint64 pos);
qint64 size() const;
bool waitForBytesWritten(int msecs);
bool waitForReadyRead(int msecs);
All of these are directly returning the equivalent function from the
QBuffer just to get the basics working before I attempt throttling. I
can see that open(), isSequential() and pos() get called but no data
ever seems to be read and the QNetworkReply fails with an UnknownError.
Is there something else I need to be doing in the QIODevice? Or
perhaps a more suitable method that I have overlooked?
Thanks.
On 29 Sep 2009, at 20:26, qt-interest-request at trolltech.com wrote:
> Em Ter?a-feira 29. Setembro 2009, ?s 16.08.45, Info escreveu:
>> Hi,
>>
>> I've been reading the documentation for QNetworkReply and I see there
>> is a setReadBufferSize which can be used to throttle downloads. Is
>> there an equivalent setWriteBufferSize to throttle uploads or will
>> this require creating a QIODevice derived object to handle the
>> throttling?
>
> If you want to throttle the upload, just write slower to the device.
> Use the
> bytesWritten signal to be notified of when you can write more data.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090930/73b5bff7/attachment.html
More information about the Qt-interest-old
mailing list