Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QTcpSocket *connection = server_devices.nextPendingConnection();
- QSslSocket *ssl=new QSslSocket(this);
- if(ssl->setSocketDescriptor(connection->socketDescriptor(),connection->state(),connection->openMode())) {
- ssl->setLocalCertificate("/home/Desktop/Smart1SSL/server.crt");
- ssl->setPrivateKey("/home/Desktop/Smart1SSL/server.key.insecure");
- ssl->startServerEncryption();
- if(ssl->waitForEncrypted()) {
- qDebug() << "Encryped!";
- clientConnection = ssl;
- }
- else {
- this->deleteLater();
- return;
- }
- }
- else {
- this->deleteLater();
- return;
- }
- qDebug() << ssl->sslErrors() << ssl->errorString() << ssl->error();
- connect(clientConnection, SIGNAL(readyRead()), this, SLOT(readFromSocket()));
- connect(clientConnection, SIGNAL(disconnected()), this, SLOT(deleteLater()));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement