I'm working in a QT complex application that serves HTTP/TCP requests through QT 4.8 slots.
Example module (QT slot):
QString HelloWorld::greet()
{
return "Hello world...";
}
With this module, we can call our service through either HTTP or TCP request.
I'm adding a new module that needs to synchronously retrieve data from an external HTTP server. For this, I'm using a QEventLoop and QNetworkAccessManager.
The problem happens on the behavior of QEventLoop. I have minimized my problem to this:
bool NewModule::sendRequest()
{
QEventLoop loop;
qDebug() << "BEFORE";
loop.exec();
qDebug() << "AFTER";
}
When I call this method from entry point X (i.e. doing an HTTP request), the event loop does loop (logs "BEFORE" only), but when calling the same method from entry point Y (i.e. doing a TCP request), the event loop doesn't loop (logs "BEFORE" and "AFTER").
I have no idea why could this different behavior occur. Can someone point me in the right direction?
Thanks