0
我拼命尝试设置QSslSocket连接,我尝试从黑莓示例开始,但始终在控制台上获取无效的URL错误,但没有任何详细信息... 以下是我尝试运行的代码:QSslSocket返回无效的网址
if (!m_socket) {
bool res;
Q_UNUSED(res);
m_socket = new QSslSocket();
// Connect to signals to receive notifications
// about state changes
res = QObject::connect(m_socket,
SIGNAL(sslErrors(QList<QSslError>)),
this,
SLOT(onSslErrors(QList<QSslError>)));
Q_ASSERT(res);
res = QObject::connect(m_socket,
SIGNAL(stateChanged(QAbstractSocket::SocketState)),
this,
SLOT(onSocketSateChange(QAbstractSocket::SocketState)));
Q_ASSERT(res);
res = QObject::connect(m_socket,
SIGNAL(error (QAbstractSocket::SocketError)),
this,
SLOT(onError(QAbstractSocket::SocketError)));
Q_ASSERT(res);
res = QObject::connect(m_socket, SIGNAL(encrypted()),
this,
SLOT(onSocketEncrypted()));
Q_ASSERT(res);
res = QObject::connect(m_socket, SIGNAL(readyRead()),
this,
SLOT(onSocketReadyRead()));
Q_ASSERT(res);
}
// Make the SSL connection to the host on the specified port
m_socket->connectToHostEncrypted("www.blackberry.com", 443);
/* if (!m_socket->waitForEncrypted()) {
qDebug() << m_socket->errorString();
//return 1;
}
*/
}
如果有人可以帮助或告诉我一个SSL样的工作?
感谢Nejat,其实我的代码工程,我succeded来管理我的CA和所有的东西的工作,但我有两次出现的URL无效在我的控制台中,我认为qsssocket尝试密钥库所有的CA,并且因此第2次失败...我应该尝试设置一个默认的可能... – user3469381