Discoverer Example

Discoverer shows how to implement and start a discovery agent that discovers KNX/netIP servers on the network.

In the main function, we create the discovery agent:

int main(int argc, char *argv[])
    QKnxNetIpServerDiscoveryAgent agent;

Then, we start the discovery agent:


Finally, we recover a list of servers:

    const auto servers = agent.discoveredServers();
    if (servers.size() > 0) {
        qInfo().noquote() << endl << QString::fromLatin1("%1 server(s) found on the network.")
        for (auto server : servers) {
            qInfo().noquote() << QString::fromLatin1("  Server: %1").arg(server.deviceName());
            qInfo().noquote() << QString::fromLatin1("      Individual address: %1").arg(server
            qInfo().noquote() << QString::fromLatin1("      Server control endpoint: %1:%2")

            auto services = server.supportedServices();
            qInfo().noquote() << QString::fromLatin1("    Supported services:");
            for (auto it = services.constBegin(); it != services.constEnd(); ++it) {
                qInfo().noquote() << QString::fromLatin1("      KNXnet/IP %1, Version: %2")
            qInfo() << "";
    } else {
        qInfo().noquote() << "No server(s) found on the network.";

    return 0;


© 2017 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.