WxWidgets 获取本机IP
跳到导航
跳到搜索
#include<wx/socket.h>
wxIPV4address addr; addr.Hostname(wxGetFullHostName()); wxString ipAddr = addr.IPAddress();
通过建立链接获取本机IP
wxIPV4address remote; remote.Hostname("www.wxwidgets.org"); remote.Service(80); wxIPV4address local; wxSocketClient client; if(client.Connect(remote)) client.GetLocal(local); wxString ipAddr=local.IPAddress();