Re: QnetworkReply Problems
Qt networking is asynchronous, postingTheDataToService() is non-blocking, and execution runs straight through the constructor. As documented, QNetworkAccessManager queues requests and sends them when the program returns to the event loop. The program does not return to the event loop until some time after the constructor has finished. Before that time the request has not even been sent, let alone answered.
Re: QnetworkReply Problems
hi...thanks for ur response........den how could i solve my problem because before returning to eventloop i has to post some data to server and use the response data which is sended by server. please provide me a solution to my problem or let me know the other way to solve it....
Regards
beggin
Re: QnetworkReply Problems
Do you really want to block a widget's constructor (and thus the whole UI) until a server request/response has been full processed?
Cheers,
_
Re: QnetworkReply Problems
Hii...thanks for reply.....
The question u asked wont be possible i think ??????Actually after hitting the service want to get the response from service ,may it take time tooo also to get response .
Is their any other way so that my output could be like dis ...
in posting------------11111
in posting------------22222222222
in posting------------333333333
in posting------------44444444
in posting------------55555555555555
Service TEst ------------T------------1111111----
Service TEst ------------T------------22222----
required response is--------"something send by service"
test--------------------1
test--------------------2
test--------------------3
Re: QnetworkReply Problems
Code:
SampleClass
::SampleClass(QWidget *parent
) : QWidget(parent
), ui
(new Ui
::SampleClass){
-----somestatements-----
-----somestatements-----
-----somestatements-----
postingTheDataToService();
}
void SampleClass:: postingTheDataToService()
{
// unchanged
}
void SampleClass::slotRequestFinished(QNetworkReply* reply)
{
if (reply->error() == QNetworkReply::NoError) { // get into the habit of checking errors
qDebug()<<"Service TEst ------------T------------1111111----\n";
qDebug()<<"Service TEst ------------T------------22222----\n";
qdebug()<<"required response is---------"<<data;
qdebug("test--------------------1");
qdebug("test--------------------2");
qdebug("test--------------------3");
}
}
Re: QnetworkReply Problems
Hey ChrisW67 thankzzzzzzzzzz a lot .....it solved my problem.........