void Server::incomingConnection(qintptr handle) { TcpClientSocket *client = new TcpClientSocket(this); client->setSocketDescriptor(handle); connect(client, SIGNAL(signalMsg(qintptr)), this, SLOT(slotReadMsg(qintptr))); connect(client, SIGNAL(signalDisconnected(qintptr, QString)), this, SLOT(slotDisconnected(qintptr, QString))); clientList.insert(handle, client); }
void AaServerWindowApp::init() { m_pServerServer = new QTcpServer(this); if(!m_pServerServer->listen(QHostAddress::Any,20000)){ qDebug()<<__PRETTY_FUNCTION__<<m_pServerServer->errorString(); close(); } m_pServerSocket = new QTcpSocket(this); m_pServerSocket->connectToHost(ipAddres,19999); connect(m_pServerSocket,SIGNAL(readyRead()),this,SLOT(slotReadMsg())); }
void AaServerWindowApp::acceptConnection() { m_pConnectSocket = m_pServerServer->nextPendingConnection(); connect(m_pConnectSocket,SIGNAL(readyRead()),this,SLOT(slotReadMsg())); }