Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for WebAssembly
  4. Local IP Address
Qt 6.11 is out! See what's new in the release blog

Local IP Address

Scheduled Pinned Locked Moved Unsolved Qt for WebAssembly
2 Posts 2 Posters 821 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.
  • B Offline
    B Offline
    BTSTOnline
    wrote on last edited by BTSTOnline
    #1

    Working on a project that needs to be cross-platform (ie, Web, Mobile, Desktop)... so I'm using Qt for WebAssembly.

    I need to find the local IP address of the device the app is running on. Works well using this:

    emscripten::val location = emscripten::val::global("location")
    QString host = QString::fromStdString(location("hostname").as<std::string>());
    

    However, I need to 'find' a few specific endpoints on the network, based on the 'host' from above.

    I run loop using QNetworkRequest and check the QNetworkReply... but cannot get the IP address of the responding device.

    These both return blank in WASM, but the correct IP in Android/Windows:

    reply->request().url();
    reply->request().url().host();
    

    Any ideas why?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      RandomGuy
      wrote on last edited by
      #2
      This post is deleted!
      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