How to create ad-hoc WiFi network

  • How can I create an ad-hoc WiFi network using Qt?

    Using QNetworkConfigurationManager it is easy to connect to an existing WLAN. But how I can establish an ad-hoc network?

  • Qt Champions 2017

  • @mrjj Thank you for your reply!

    I am not sure to be honest. Hotspot feature is used to share internet connectivity. My (embedded) device has no access to the internet. What I am trying to do: Creating an ad-hoc network, so that others (e.g. Smartphone) are able to access my device via WLAN. On the device a web server is running providing some services to users.

    This already works using bash shell scripts using shell commands like iw etc. But I have to do this in a C++ app using Qt so there is no need to call external bash scripts or shell commands.

  • Qt Champions 2017

    Hi, it does sound like a ad-hoc wifi.
    I think this feature is on driver level
    so not sure you can do it from Qt (directly)

    What about snooping around iw code and see what it does?

    Alternatively, use QProcess to run cmd line tool. Its pretty solid and
    can be hidden from the user.

  • @mrjj Yes, we are talking about ad-hoc.

    Already having a solution that's using a similar approach (QProcess) you mentioned.

    iw tool is saying the following:
    Do NOT screenscrape this tool, we don't consider its output stable.

    So the idea was born doing it with Qt only ...

    Looking into the iw code is a good idea:

    But I am wondering that I am the first person on this planet who likes to create an ad-hoc WLAN with Qt ..."ad-hoc"+with+Qt
    (we are the first)

  • Qt Champions 2017

    well if iw works and target is linux, and you mostly depend on this tool to turn it on, then
    it might work ok.
    Other reason is:

    "iw is a new nl80211 based Linux CLI configuration utility for wireless devices.

    It supports all new drivers that have been added to the kernel recently. "

    So it might not be easy to ask to turn it on if its via drivers.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.