mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Update IsNumericAddress
Better then heuristic check
This commit is contained in:
parent
1e03ac3f65
commit
0b9f676399
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue