sdlNetResolveIp function
Resolve an IP address to a host name in canonical form.
If the IP couldn't be resolved, this function returns NULL, otherwise a pointer to a static buffer containing the hostname is returned.
Warning: This function is not thread-safe!
\param ip the IP address to resolve into a hostname.
\since This function is available since SDL_net 2.0.0.
extern DECLSPEC const char * SDLCALL SDLNet_ResolveIP(const IPaddress *ip)
Implementation
String? sdlNetResolveIp(Pointer<IPaddress> ip) {
final sdlNetResolveIpLookupFunction = libSdl2Net.lookupFunction<
Pointer<Utf8> Function(Pointer<IPaddress> ip),
Pointer<Utf8> Function(Pointer<IPaddress> ip)>('SDLNet_ResolveIP');
final result = sdlNetResolveIpLookupFunction(ip);
if (result == nullptr) {
return null;
}
return result.toDartString();
}