void dataReceivedCallback(int fd)
{
    if (fd == serverSocket)
    {
        readMessageFromServer();
    }
    else
    {
        if (didChildKill(fd))
        {
            ++killCount;
        }
    }
}
Beispiel #2
0
void MainWindow::on_btnConnect_clicked()
{
    //Préparation de la socket
    tcpSocket = new QTcpSocket(this);
    connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readMessageFromServer()));

    //Tentative de connection au server
    tcpSocket->connectToHost(ui->txtIP->toPlainText(),ui->txtPORT->toPlainText().toInt());

    if(tcpSocket->waitForConnected())
    {
        connected=true;
        //une fois qu'on est connecter on l'indique et on envoie la clef d'identification
        ui->txtStatus->setPlainText("Connecter !");
        QString cmd = "Tux_Key("+ui->txtUKEY->toPlainText()+")";
        tcpSocket->write(cmd.toUtf8());
    }
}