0

QAbstractSocket throws UnsupportedSocketOperationError when connecting to a host over QSslSocket::connectToHostEncrypted(),

Environnement: Qt 5.9.3 Ubuntu 16.04 (virtual machine) also Qt 5.9.3 Fedora 26 (native)

_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
}

Can you please help me?
I don't understand the error and why it is happening?

Azeem
  • 11,148
  • 4
  • 27
  • 40
tbone
  • 23
  • 6
  • Your virtual machine does not support it. `UnsupportedSocketOperationError: The requested socket operation is not supported by the local operating system (e.g., lack of IPv6 support).` – user3606329 Jan 17 '18 at 15:36
  • Today i tested it on a Fedora 26 (no virtual machine) and it is also happening. – tbone Jan 18 '18 at 07:38
  • Then your IP address is not correct. The code does not contain any error (beside your weird { } when creating the socket on heap) – user3606329 Jan 18 '18 at 23:33

0 Answers0