communication between objects and tcpsockets
Can someone tell me a good solution how to communicate between client objects? In this case :how can i send a message from a single class of the client object to other Client objects with a message?
Its a server application and here is the code:
Code:
{
this->threadpool = new QThreadPool(this);
threadpool->setMaxThreadCount(10);
threadpool->setExpiryTimeout(30000);
}
Server::~Server(){
this->close();
}
void Server::incomingConnection(int handle){
Client * client = new Client();
klient->setAutoDelete(false);
client->setSocketDescriptor(handle);
this->threadpool->tryStart(client);
}
Client class:
void Client::run(){
connect(this,SIGNAL(readyRead()),this,SLOT(readData()));
}
void Client::readData(){
//reading and sending forward to all objects of this class
}
Is it possible and a good solution to create a static member QList<Client*> and iterate inside the
readyread funcion to gaina all objects of that class and post an event? SOmething like that:
Code:
void Client::readData(){
Client * tmp = iterating QList<Client*>
{
}
}
Re: communication between objects and tcpsockets