15,471
社区成员
发帖
与我相关
我的任务
分享
void ServerThread::run()
{
mySocket = new MyTcpSocket(socketDescriptor,0);
//绑定套接字标识符
if ( !mySocket->setSocketDescriptor(socketDescriptor) ) {
emit error(mySocket->error()); //将错误信息发送出去
return ;
}
threadStarted();
connect(mySocket, SIGNAL(disconnected()), this, SLOT(disconnectToHost()));
//直接将套接字接收到的数据发送出去
connect(mySocket, SIGNAL(receiveData(QString, QByteArray)), this, SLOT(dataProcessing(QString, QByteArray)),Qt::BlockingQueuedConnection);
connect(this, SIGNAL(sendData(QByteArray, int)), mySocket, SLOT(sendMessage(QByteArray,int)));
exec();
}