Solved QNetworkManager periodically stops the tcp communication
-
I am creating a program with two different flows of data: one tcp wireless connection receiving about 24 kB/s, with a home made socket interface implementation, and eventually some http requests (also wireless), with the QNetworkManager class.
I realized that it works like a charm if I only have the tcp connection. But, as soon as I instantiate the network manager class, then every 10 seconds the tcp communication is interrupted for 1 second. This happens even if I don't create any http request. See the picture of a capture of the network using wireshark to see the behaviour. Is there anything in this class that periodically causes this effect? -
Looks like there is a internal slot in the QNetworkAccessManager that blocks the network access every 10 seconds.
I have tried moving the class to another thread and it works as expected.QNetworkAccessManager qnam; QThread thread; qnam.moveToThread(&thread); thread.start();
-
@purcola I you sure it's not something in your app? I don't think there is anything in QNetworkManager periodically stopping network communication.
-
Could be. But I have tried with different applications and the behaviour is the same.
I did a test in a UDP streaming application over the very same wireless network. The only line I added to the code is the following:QNetworkAccessManager manager;
The results are the same: Every 10 seconds there is something going on in the network.
andAny clues?
-
Looks like there is a internal slot in the QNetworkAccessManager that blocks the network access every 10 seconds.
I have tried moving the class to another thread and it works as expected.QNetworkAccessManager qnam; QThread thread; qnam.moveToThread(&thread); thread.start();