【发布时间】:2014-03-27 16:25:53
【问题描述】:
我正在拼命尝试设置 QSslSocket 连接,我尝试从黑莓示例开始,但总是在我的控制台上收到 Invalid URL 错误,没有任何详细信息... 这是我尝试运行的代码:
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 示例工作...
【问题讨论】:
标签: qt blackberry-10 qnx