[英]Is QNetworkReply::finished() signal called sequentially or simultaneously?
It's a HTTP request sending method.它是一种 HTTP 请求发送方法。 When the goal website responses, httpFinished() will be called.
当目标网站响应时,将调用 httpFinished()。
void HTTPClientBase:: HttpRequestGet()
{
QNetworkRequest network_request;
network_request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
network_request.setUrl(URL);
reply = network_manager.get(network_request);
connect(reply, SIGNAL(finished()), this, SLOT(httpFinished()));
}
void HTTPClientBase::httpFinished()
{
// process the reply;
}
I can call HttpRequestGet() in a loop.我可以循环调用 HttpRequestGet() 。
static HTTPClientBase myClient;
for(...)
{
myClient.setUrl(...);
myClient.HttpRequestGet();
}
Since the the request and response are async, so the loop can be done within an instant time.由于请求和响应是异步的,所以循环可以在瞬间完成。 After several hundreds milliseconds, httpFinished() will be called successively.
数百毫秒后,将依次调用 httpFinished()。
I want to know httpFinished() will be called sequentially or simultaneously.我想知道 httpFinished() 将被依次或同时调用。 In other words, if I need to concern simultaneous-programming problems, for example, writing the response datas into a single file.
换句话说,如果我需要关注同步编程问题,例如,将响应数据写入单个文件。
The following statements indicate that the httpFinished method will not be executed more than once at the same time:以下语句表明 httpFinished 方法不会同时执行多次:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.