netGetAddressStatus function net

int netGetAddressStatus(
  1. Pointer<NetAddress> address
)

Check if an address is resolved, without blocking.

The NET_Address objects returned by NET_ResolveHostname take time to do their work, so it does so asynchronously instead of making your program wait an indefinite amount of time.

This function allows you to check the progress of that work without blocking.

Resolution can fail after some time (DNS server took awhile to reply that the hostname isn't recognized, etc), so be sure to check the result of this function instead of assuming it worked because it's non-zero!

Once an address is successfully resolved, it can be used to connect to the host represented by the address.

\param address The NET_Address to query. \returns NET_SUCCESS if successfully resolved, NET_FAILURE if resolution failed, NET_WAITING if still resolving (this function timed out without resolution); if NET_FAILURE, call SDL_GetError() for details.

\threadsafety It is safe to call this function from any thread.

\since This function is available since SDL_net 3.0.0.

\sa NET_WaitUntilResolved

extern SDL_DECLSPEC NET_Status SDLCALL NET_GetAddressStatus(NET_Address *address)

Implementation

int netGetAddressStatus(Pointer<NetAddress> address) {
  final netGetAddressStatusLookupFunction = _libNet
      .lookupFunction<
        Int32 Function(Pointer<NetAddress> address),
        int Function(Pointer<NetAddress> address)
      >('NET_GetAddressStatus');
  return netGetAddressStatusLookupFunction(address);
}