Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
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()));
}
Ejemplo n.º 3
0
void AaServerWindowApp::acceptConnection()
{
    m_pConnectSocket = m_pServerServer->nextPendingConnection();
    connect(m_pConnectSocket,SIGNAL(readyRead()),this,SLOT(slotReadMsg()));
}