Update IsNumericAddress

Better then heuristic check
This commit is contained in:
Brendon 2026-03-15 20:16:41 -07:00
parent 1e03ac3f65
commit 0b9f676399

View file

@ -213,16 +213,17 @@ void WinsockNetLayer::Shutdown()
bool WinsockNetLayer::IsNumericAddress(const char* addr)
{
if (addr == NULL)
if (addr == nullptr)
return false;
if (strchr(addr, ':') != NULL)
return true;// IPv6
in6_addr buf{};
if (inet_pton(AF_INET6, addr, &buf) == 1)
return true;
if (inet_addr(addr) != INADDR_NONE)
return true;// IPv4
if (inet_pton(AF_INET, addr, &buf) == 1)
return true;
return false;// hostname
return false;
}
bool WinsockNetLayer::HostGame(int port, const char* bindIp)