Example #1
0
void Client::connectToChatServer()
{
    blockSize = 0;
    secureSocket->abort();
    secureSocket->setPeerVerifyMode(QSslSocket::QueryPeer);
    secureSocket->connectToHostEncrypted(hostLineEdit->text(),
                             portLineEdit->text().toInt());
    if (!secureSocket->waitForEncrypted(1000)) {
         QMessageBox::critical(this, "ERROR", "ERROR: Could not connect to host");
         return;
    }
	sendToServer(tr("$name %1").arg(clientNameLineEdit->text()));
    displayCertificateWindow();
    //QSslCertificate peerCertificate = secureSocket->peerCertificate();
    //qDebug() << "Peer Certificate is: " << endl;
    //qDebug() << peerCertificate << endl;
    //QSslCertificate localCertificate = secureSocket->localCertificate();
    //qDebug() << "Local Certificate is: " << endl;
    //qDebug() << localCertificate << endl;
}
Example #2
0
void Client::requestNewFortune()
{
    getFortuneButton->setEnabled(false);
    blockSize = 0;
    secureSocket->abort();
    secureSocket->setPeerVerifyMode(QSslSocket::QueryPeer);
    secureSocket->connectToHostEncrypted(hostLineEdit->text(),
                             portLineEdit->text().toInt());
    if (!secureSocket->waitForEncrypted(1000)) {
         QMessageBox::critical(this, "ERROR", "ERROR: Could not connect to host");
         return;
    }
    displayCertificateWindow();
    //QSslCertificate peerCertificate = secureSocket->peerCertificate();
    //qDebug() << "Peer Certificate is: " << endl;
    //qDebug() << peerCertificate << endl;
    //QSslCertificate localCertificate = secureSocket->localCertificate();
    //qDebug() << "Local Certificate is: " << endl;
    //qDebug() << localCertificate << endl;
}