i've just made an own implementation of QTcpServer and overloaded the incomingConnection
function.
void Server::incomingConnection(int handle) //Server inherits from QTcpServer
{
qDebug()<<"Server::incomingConnection"<<handle;
Thread *thread = new Thread(handle,this);
connect(thread,SIGNAL(finished()),this,SLOT(deleteLater()));
thread->start();
}
In the Thread i do the following things:
void Thread::run()
{
qDebug() << m_socketDescriptor << "Starting Thread";
m_socket = new QTcpSocket();
if(!m_socket->setSocketDescriptor(m_socketDescriptor))
return;
connect(m_socket,SIGNAL(readyRead()),this,SLOT(readyRead()));
connect(m_socket,SIGNAL(disconnected()),this,SLOT(disconnected()));
qDebug() << m_socketDescriptor << "Client connected";
exec();
}
Now i've a multithreaded server.
But how can i get access to the connected clients and send them data via. a gui?
Thank you in advance!
Regards