Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
elmigranto last edited by
I'm writing a program that relies on client-server communication (about 10 lightweight requests per minute). We're using JSON API over HTTP. Client is written in C++/Qt.
Since I'm kind of Junior, I've been looking for example or guide on using QNetworkAccessManager (not help on API, but real-world example) for couple of weeks. No luck in googling such thing. Finally, I've written my own buggy wrapper. After awhile, it's rewritten in simpler and cleaner way (from my POV).
I hope someone will review my code and point to weak spots. Maybe some advice on class structure or coding style?
Code is available on bitbucket: https://bitbucket.org/elmigranto/qnamwrapper/src
Also, there is a bug related to QNAM limitation (max 6 connections to host:port). I can't find a way for starting timer with actual request start (not just creating). Pointing in right direction about that could also be great. Is there any related signal, maybe?
Any ideas on how to achieve thread-safety?
Any feedback is appreciated.
Kind of dropped project, will reconsider in future.
sidewinder last edited by
I use "QAbstractSocket::stateChanged(...)":http://qt-project.org/doc/qt-4.8/qabstractsocket.html#stateChanged signal to get socket state changes in addition to other signals like error, readready etc.