Why my SSL client/server doesn't work?
-
Hi everybody.
I wrote a client and server that use SSL to communicate but they don't work.
Here is the code I wroteServer:
@
void LanServer::incomingConnection(int socketDescriptor){
//LanServer inherits from QTcpServer
/tcpSocket is a pointer to a QSslSocket allocated on the heap in LanServer constructor/
if (!tcpSocket->setSocketDescriptor(socketDescriptor)) {
emit error(tcpSocket->error());
return;
}
tcpSocket->startServerEncryption();
}
@Client:
@
void LanClient::ConnectToHost(){
//LanClient inherits from QObject
/tcpSocket is a pointer to a QSslSocket allocated on the heap in LanClient constructor/
tcpSocket->connectToHost("localhost",7677);
if(!tcpSocket->waitForConnected())
emit CantConnect();
tcpSocket->startClientEncryption();
if(!tcpSocket->waitForEncrypted())
emit CantConnect(); //This is always executed
}
@Can you please help me solve this problem?
-
check if incomingConnection is called... A friend encountered that problem also when he tried to rewrite incomingConnection...
-
It's called and the connection is established, what fails is the encryption