使用QSslSocket

时间:2018-01-17 14:56:46

标签: qt qsslsocket qt5.9 qabstractsocket

QAbstractSocket上连接主机时

UnsupportedSocketOperationError抛出QSslSocket::connectToHostEncrypted()

Environnement:Qt 5.9.3 Ubuntu 16.04(虚拟机)也Qt 5.9.3 Fedora 26(原生)

_socket = new QSslSocket{this};
connect(_socket, static_cast<void(QAbstractSocket::*) QAbstractSocket::SocketError) (&QAbstractSocket::error), this, &EventResource::streamError);

_socket->connectToHostEncrypted(_device->addressUrl().host(), 443, QSslSocket::ReadWrite, QSslSocket::IPv4Protocol);

void EventResource::streamError(QAbstractSocket::SocketError error)
{
    QDebug() << "Event error: " << error; 
    //QAbstractSocket::UnsupportedSocketOperationError
}
你能帮帮我吗? 我不明白错误及其发生的原因?

0 个答案:

没有答案