我使用C ++和Qt5.15.x。我已经构建了桌面应用程序的WebAssembly版本。该应用程序是使用“ http://192.168.21.55:5555”之类的URL加载的(内部网应用程序)。我想在WebAssembly应用程序中提取服务器IP地址。我该如何实现?
没有用于ip提取的解决方案,但是我已经找到了获取主机和端口的方法(在我的情况下,host等于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>());