void SslServer::incomingConnection(int socketDescriptor)
{
socket = new QSslSocket(this);
qDebug() << "Nowe polaczenie nadchodzi";
socket->setPrivateKey("C:\\serwer\\serverkey.pem");
if(socket->privateKey().isNull())
qDebug() << "Private key: false";
else
qDebug() << "Private key: true";
socket->setLocalCertificate("C:\\serwer\\taserver.cer");
if(socket->localCertificate().isNull())
qDebug() << "Certificate: false";
else
qDebug() << "Certificate: true";
if(socket->setSocketDescriptor(socketDescriptor))
{
qDebug() << "Descryptor: " << socket->socketDescriptor();
socket->setProtocol(QSsl::AnyProtocol);
connect(socket,SIGNAL(encrypted()),this,SLOT(ready()));
connect(socket,SIGNAL(disconnected()),this,SLOT(Disconnected()));
connect(socket,SIGNAL(sslErrors(QList<QSslError>)),this,SLOT(bledySSL(QList<QSslError>)));
connect(socket,SIGNAL(modeChanged(QSslSocket::SslMode)),this,SLOT(mode(QSslSocket::SslMode)));
connect(socket,SIGNAL(peerVerifyError(QSslError)),this,SLOT(bladPeer(QSslError)));
socket->startServerEncryption();
qDebug() << socket->errorString();
qDebug() << "Connection state: " << socket->state();
qDebug() << "Connection mode: " << socket->mode();
}
}
void SslServer::incomingConnection(int socketDescriptor)
{
socket = new QSslSocket(this);
qDebug() << "Nowe polaczenie nadchodzi";
socket->setPrivateKey("C:\\serwer\\serverkey.pem");
if(socket->privateKey().isNull())
qDebug() << "Private key: false";
else
qDebug() << "Private key: true";
socket->setLocalCertificate("C:\\serwer\\taserver.cer");
if(socket->localCertificate().isNull())
qDebug() << "Certificate: false";
else
qDebug() << "Certificate: true";
if(socket->setSocketDescriptor(socketDescriptor))
{
qDebug() << "Descryptor: " << socket->socketDescriptor();
socket->setProtocol(QSsl::AnyProtocol);
connect(socket,SIGNAL(encrypted()),this,SLOT(ready()));
connect(socket,SIGNAL(disconnected()),this,SLOT(Disconnected()));
connect(socket,SIGNAL(stateChanged(QAbstractSocket::SocketState)),SLOT(stany(QAbstractSocket::SocketState)));
connect(socket,SIGNAL(error(QAbstractSocket::SocketError)),this,SLOT(bledy(QAbstractSocket::SocketError)));
connect(socket,SIGNAL(sslErrors(QList<QSslError>)),this,SLOT(bledySSL(QList<QSslError>)));
connect(socket,SIGNAL(modeChanged(QSslSocket::SslMode)),this,SLOT(mode(QSslSocket::SslMode)));
connect(socket,SIGNAL(peerVerifyError(QSslError)),this,SLOT(bladPeer(QSslError)));
socket->startServerEncryption();
qDebug() << socket->errorString();
qDebug() << "Connection state: " << socket->state();
qDebug() << "Connection mode: " << socket->mode();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks