Important: Please read the Qt Code of Conduct -

Connection issue OPC UA

  • Why is it this stalls on connecting?

    #include <QCoreApplication>
    #include "QOpcUaProvider"
    #include <QtOpcUa/QOpcUaClient>
    #include <QUrl>
    #include <QString>
    #include <string>

    #include <iostream>

    int main(int argc, char *argv[])
    QCoreApplication a(argc, argv);

    QOpcUaProvider provider;
        return a.exec();
    QOpcUaClient *client = provider.createClient(provider.availableBackends()[0]);
        return a.exec();
    QUrl OpcUa_server("opc.tcp://");
    if(client->requestEndpoints(OpcUa_server) == true){
        return a.exec();

  • Lifetime Qt Champion

    @athyc probably because most Qt communication classes need the Qt event loop a.exec() to be running. You'll need to refactor your app so a.exec() is running before you start your OPC communication.


Log in to reply