Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT MQTT TLS Failed
Forum Updated to NodeBB v4.3 + New Features

QT MQTT TLS Failed

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 323 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    arilink
    wrote on last edited by arilink
    #1

    Development environment
    1.windows10 x64
    2.qt and mqtt version 5.15.2
    3.compiler: mingw 8.1
    Question:
    I tried to add the TLS function on the basis of mqtt client to facilitate secure transmission, but after turning on TLS, I cannot connect to the server. The error message is 256 QMqttClient::TransportInvalid

    Code:
    m_client = new QMqttClient(this);
    const QString hostname{"test.mosquitto.org"};
    const quint16 port = 8883;
    if(QSslSocket::supportsSsl())
    {
    qDebug()<<"SSL SUPORTED";
    };
    QSslCertificate cert = QSslCertificate(pem,QSsl::Pem);
    QSslConfiguration conf;
    conf.setCaCertificates({cert});
    conf.setProtocol(QSsl::TlsV1_2);
    m_client->setHostname(hostname);
    m_client->setPort(port);
    QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
    m_client->connectToHostEncrypted(conf);

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved