Qt-interest Archive, July 2007
QSslSocket error
Message 1 in thread
Hi,
I'm having a problem with QSslSocket. The programme listed below gives
the following output when I attempt to connect with SSL based
applications (Firefox, IE and the 'telnet-ssl localhost -z ssl'). I am
having this problem with Ubuntu 7.04 and Windows XP (using QT 4.3.0 and
OpenSSL 0.9.8). Could some one tell me what I am doing wrong as I have
no prior experience with Open SSL.
Regards
Matt
void SSLServer::incomingConnection(int socketDescriptor)
{
QSslSocket *serverSocket = new QSslSocket;
connect(serverSocket, SIGNAL(encrypted()), this, SLOT(ready()));
connect(serverSocket, SIGNAL(disconnected()), this,
SLOT(discardClient()));
connect(serverSocket, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(error(QAbstractSocket::SocketError)));
serverSocket->setSocketDescriptor(socketDescriptor);
qDebug("Starting encryption");
serverSocket->startServerEncryption();
if (serverSocket->waitForConnected(10000))
qDebug("Connected");
else
qDebug("Not Connected");
if (serverSocket->waitForEncrypted(10000))
qDebug("Encrypted!");
else
qDebug("Not Encrypted");
}
void SSLServer::error( QAbstractSocket::SocketError err )
{
QSslSocket *socket = qobject_cast<QSslSocket*>(sender());
qDebug() << "Error:" << (int)err << socket->errorString();
}
void SSLServer::discardClient()
{
qDebug("Dissconnected");
}
void SSLServer::ready()
{
qDebug("Ready");
}
Output:
Starting encryption
Connected
Error: -1 "Error during SSL handshake: error:1408F10B:SSL
routines:SSL3_GET_RECORD:wrong version number"
Dissconnected
Not Encrypted
--
[ signature omitted ]