// this runs in a separate thread
void myServerThread::run(){
for(count=0;count<numConn;count++){
signalMapperAcceptConnection->setMapping( tcpServer[count], count);
signalMapperReadData->setMapping( tcpClient[count], count);
connect(tcpServer[count], SIGNAL(newConnection()), signalMapperAcceptConnection, SLOT(map()));
}
connect( signalMapperAcceptConnection, SIGNAL(mapped(int)), this, SLOT(acceptConnection(int)),
Qt::DirectConnection);
exec();
}
void myServerThread::acceptConnection(int objectID){
static unsigned short signalCounter = 0;
tcpClient[objectID] = tcpServer[objectID]->nextPendingConnection();
connect( tcpClient[objectID], SIGNAL(readyRead()), signalMapperReadData, SLOT(map()));
signalCounter++;
if(signalCounter == numConn)
connect( signalMapperReadData, SIGNAL(mapped(int)), this, SLOT(startRead(int)), Qt::DirectConnection);
}
// this runs in a separate thread
void myServerThread::run(){
for(count=0;count<numConn;count++){
signalMapperAcceptConnection->setMapping( tcpServer[count], count);
signalMapperReadData->setMapping( tcpClient[count], count);
connect(tcpServer[count], SIGNAL(newConnection()), signalMapperAcceptConnection, SLOT(map()));
}
connect( signalMapperAcceptConnection, SIGNAL(mapped(int)), this, SLOT(acceptConnection(int)),
Qt::DirectConnection);
exec();
}
void myServerThread::acceptConnection(int objectID){
static unsigned short signalCounter = 0;
tcpClient[objectID] = tcpServer[objectID]->nextPendingConnection();
connect( tcpClient[objectID], SIGNAL(readyRead()), signalMapperReadData, SLOT(map()));
signalCounter++;
if(signalCounter == numConn)
connect( signalMapperReadData, SIGNAL(mapped(int)), this, SLOT(startRead(int)), Qt::DirectConnection);
}
To copy to clipboard, switch view to plain text mode
Bookmarks