获取本地IP地址

// Module: Sockets.build.cs

#include "SocketSubsystem.h"
#include "IPAddress.h"
#include "Interfaces/IPv4/IPv4Endpoint.h"

bool canBind = false;
TSharedRef<FInternetAddr> localIp = ISocketSubsystem::Get(PLATFORM_SOCKETSUBSYSTEM)->GetLocalHostAddr(*GLog, canBind);
FIPv4Endpoint LocalEndpoint = FIPv4Endpoint(localIp);
LocalIP = LocalEndpoint.Address.ToString();