Hello,
I am currently working an a server/client application using SSL/TCP.
In order do archive this, i do the following:
1. create a QTcpServer
2. make it listen to any host address and a specific port
3. connect the "newConnection()" SIGNAL to my "newTcpConnection()" SLOT
4. There i use the socketDescriptor of the nextPendingConnection and set it to a new sslSocket
The code looks like this:
void sslServer::newTcpConnection()
{
qDebug() << "New TCP connection";
qintptr descriptor = tcpServer->nextPendingConnection()->socketDescriptor();
QSslSocket *sslSocket = new QSslSocket(this);
if (!sslSocket->setSocketDescriptor(descriptor)) { //<--Displays mentioned error
qCritical() << "Setting socket descriptor failed";
emit error(sslSocket->errorString());
delete sslSocket;
return;
}
...
}
void sslServer::newTcpConnection()
{
qDebug() << "New TCP connection";
qintptr descriptor = tcpServer->nextPendingConnection()->socketDescriptor();
QSslSocket *sslSocket = new QSslSocket(this);
if (!sslSocket->setSocketDescriptor(descriptor)) { //<--Displays mentioned error
qCritical() << "Setting socket descriptor failed";
emit error(sslSocket->errorString());
delete sslSocket;
return;
}
...
}
To copy to clipboard, switch view to plain text mode
But i do not understand why I get the following warning:
"QSocketNotifier: Multiple socket notifiers for the same socket 520 and type Read"
The warning occurs when executing the marked line.
I do not use threads and i create a new socket for every new connection,
therefore it should only be one socket notifier per sslSocket.
I would appreciate any help.
Thank you!
Bookmarks