One QNetworkAccessManager instance.
musimbate last edited by
Looking at the QNetworkAccessManager doc ,It suggests that just having one instance in the entire Qt application is enough.Can anyone enlighten me on the reason why? I usually have one instance in my applications and it become a habit.I had a discussion with one of my teammates (whos been instantiating tones of them in his applications) and besides it makes your app more manageable and the official Qt doc suggests it ,I couldn't come up with a compeling reason.Do you guys know of other reasons the Doc suggests one instance?Thank you for your time.
ileonte last edited by ileonte
QNetworkAccessManagerdoesn't actually do much in the way of actually handling network connections. Once it creates a
QNetworkReplyobject - for example as a result of the application calling the
post()method - its job is pretty much done. The actual work of reading/writing data to/from the socket will be handled by the
QNetworkReplyobject itself. Since you can create as many of these objects as you want using a single
QNetworkAccessManagerthere really is no need to have more than one network access manager object alive at any given time.