gpt4 book ai didi

qt - QNetworkReply 是否总是发出完成()?

转载 作者:行者123 更新时间:2023-12-04 13:18:10 24 4
gpt4 key购买 nike

我阅读了信号完成()的文档,它没有说完成()总是发出。我读取了 error() 信号:

void QNetworkReply::error(QNetworkReply::NetworkError code) This signal is emitted when the reply detects an error in processing. The finished() signal will probably follow, indicating that the connection is over.

The code parameter contains the code of the error that was detected. Call errorString() to obtain a textual representation of the error condition.

Note: Do not delete the object in the slot connected to this signal. Use deleteLater().

See also error() and errorString().



是否行 The finished() signal will probably follow意味着,在某些情况下, QNetworkReply 不会发出 finished() ?

最佳答案

对于 QNetworkReply 错误信号,我们当然可以预期错误代码并不意味着连接断开。例如:

QNetworkReply::ContentNotFoundError 203 the remote content was not found at the server (similar to HTTP error 404)



在上面的情况下,连接肯定还没有完成。没有发出结束信号。

QNetworkReply::RemoteHostClosedError 2 the remote server closed the connection prematurely, before the entire reply was received and processed



那么连接肯定就完成了。并发出完成信号。

关于qt - QNetworkReply 是否总是发出完成()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31467191/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com