PDA

View Full Version : the pure virtual method "abort" in QNetworkReply



mavenlin
9th July 2011, 08:27
Hi guys:

I'm confused about the pure virtual function abort in the QNetworkReply.
It is never implemented. what do you guys do if you want to abort a httpget?
since according to the doc, using the close() function only closes the IODevice to prevent further reading, but the network resources are not discarded.
And I'm wondering whether it is safe to delete the QnetworkReply instance when it is still receiving data from the network.

Since it is natural to abort a network request in curl, I think there must be an equivalent method in Qt.

If any of you have subclassed QNetworkReply and implemented the abort function, can you share the code to me? Any other solutions are welcomed.

Thank you!

ChrisW67
9th July 2011, 09:31
There is an implementation of abort() in the QNetworkReply objects returned by QNetworkAccessManager. These objects are actually of type QNetworkReplyImpl: see src/network/access/qnetworkreplyimpl.cpp (http://qt.gitorious.org/qt/qt/blobs/4.7/src/network/access/qnetworkreplyimpl.cpp) in the Qt sources.

mavenlin
9th July 2011, 10:01
Nice! I see.
Thank you!