在 wasm 应用程序中获取服务器 IP
Getting server IP within wasm application
我使用 C++ 和 Qt 5。15.x。我已经构建了我的桌面应用程序的 WebAssembly 版本。
该应用程序使用 URL 加载,例如“http://192.168.21.55:5555”(内网应用程序)。我想在 WebAssembly 应用程序中提取服务器 IP 地址。我怎样才能实现它?
没有提取ip的解决方案,
但我找到了获取主机和端口的方法(在我的例子中主机等于 ip)。
#include <emscripten/val.h>
emscripten::val location = emscripten::val::global("location");
auto host = QString::fromStdString(location["host"].as<std::string>());
auto port = QString::fromStdString(location["port"].as<std::string>());
我使用 C++ 和 Qt 5。15.x。我已经构建了我的桌面应用程序的 WebAssembly 版本。 该应用程序使用 URL 加载,例如“http://192.168.21.55:5555”(内网应用程序)。我想在 WebAssembly 应用程序中提取服务器 IP 地址。我怎样才能实现它?
没有提取ip的解决方案, 但我找到了获取主机和端口的方法(在我的例子中主机等于 ip)。
#include <emscripten/val.h>
emscripten::val location = emscripten::val::global("location");
auto host = QString::fromStdString(location["host"].as<std::string>());
auto port = QString::fromStdString(location["port"].as<std::string>());