Hi all,
I'm trying to build a custom server which can check all the clients to check availability of them and gather some informations. All clients has their own webservers so I don't have to tackle with QTcpSocket. I'm just putting and get request via QNetworkAccessManager and waiting for the reply. When reply arrives, updating the GUI. And if someone select a client from gui I must serve latest informations about the selected client to the user.
I'm trying to figure out how can it be done. I mean what type of struct should I use to accomplish that?
Until now I've tried this way;
- Read all client informations from database.
- create a thread for each of clients.
- send them required gui control pointers, so they can use these pointers to update their informations in runtime.
But for example if I have 1500 clients then it means I have 1500 threads (WOW) and when all of them start to gather informations from clients at the same time 1500 get request will be done simultaneously. I wonder do I need 1500 threads? But after that I'm thinking that if I try to do this with a single thread all of the get requests will be done sequential and if I have 100 clients and do sequential request, if all of them reply with maximum timeout of QNetworkAccess::get method, then the user will wait (100 * maximumtimeout) secs to gather information all of them.
How can it be accomplished via another way? I couldn't figure out.
Thanks for help.
Edit:
In current status of the project, client object is subclassing QThread and reimplementing run() method. And another mainclass is creating one for each client and start it.
Bookmarks