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. How to register Wifi network in ubuntu 14.04 using QNetworkConfiguration in Qt
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 559 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.
  • L Offline
    L Offline
    lalvishnu12
    wrote on last edited by
    #1

    @#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 = configuration.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.

    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