how can i make sure to get the server response correctly when i invoke the server with QNetworkReque

Posted by noname on Stack Overflow See other posts from Stack Overflow or by noname
Published on 2010-03-31T09:56:51Z Indexed on 2010/04/16 23:53 UTC
Read the original article Hit count: 187

Filed under:
|
|

I wrote the server site call in Qt, but i haven't get the server response for every server invoking. I have to use the server reply to continue the program flow.

The request is correctly reached to server and server do reply.The server is also on my machine.

Here is the code how i make the server site call; QNetworkAccessManager nam1 = new QNetworkAccessManager(this);
qnetmg=nam1;

    QObject::connect(nam1, SIGNAL(finished(QNetworkReply*)),this,SLOT(finishedGettingMarker(QNetworkReply*)));
    QString strurl="http://localhost:8080/ServerWeb"; 

    QUrl url(strurl);       
    QNetworkRequest preq(url);        
    QNetworkReply* reply = nam1->get(preq);
    qreply=reply;

Inside finisedGettingMarker slot, i have already eliminate for QNetworkReply->error case and i used one global variable for QNetworkAccessManager;"qnetmg" and one global variable for QNetworkReply;"qreply". And also i make qnetmg.disconnect(this,0); and qreply.abort(); inside that slot method.

But the problem is i haven't got the response for every server invoking time. If anyone who know the way to solve it , please reply me.

This situation happened only in Opera.

Thanks in advance.

© Stack Overflow or respective owner

Related posts about qt

Related posts about qnetworkaccessmanager