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 Update on Monday, May 27th 2025

QT MQTT TLS Failed

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 311 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 26 Apr 2021, 16:00 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

    1/1

    26 Apr 2021, 16:00

    • Login

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