Nominate our 2022 Qt Champions!

How to register Wifi network in ubuntu 14.04 using QNetworkConfiguration in Qt

  • @#include <winsock2.h>
    void BearerMonitor::registerNetwork()
    QTreeWidgetItem *item = treeWidget->currentItem();
    if (!item) return;

            QNetworkConfiguration configuration =
                    manager.configurationFromIdentifier(item->data(0, Qt::UserRole).toString());
            const QString name =;
            qDebug() << "Registering" << name << "with system";
            WSAQUERYSET networkInfo;
            memset(&networkInfo, 0, sizeof(networkInfo));
            networkInfo.dwSize = sizeof(networkInfo);
            networkInfo.lpszServiceInstanceName = (LPWSTR)name.utf16();
            networkInfo.dwNameSpace = 15;
            if (WSASetService(&networkInfo, RNRSERVICE_REGISTER, 0) == SOCKET_ERROR)
                qDebug() << "WSASetService(RNRSERVICE_REGISTER) returned" << WSAGetLastError();

    Hi, The above code is used to register a wifi network in windows OS using QNetworkConfiguration class.I need to do the same in Ubuntu 14.04. please help me to do so.

Log in to reply