NET_GetAddressStatus(3)

πŸ“¦
version 3.2.0 Β· 2 versions
, in fedora 43, fedora 44

πŸ’– NET_GetAddressStatus(3) πŸ’–

okay bestie, welcome to the SDL_net3 section of the manual, and today we're talking about NET_GetAddressStatus β€” the little function that lets you peek at your DNS resolution like a nosy queen without ever getting stuck waiting. πŸ•΅οΈβ™€οΈβœ¨


✨ NAME ✨

NET_GetAddressStatus β€” check if an address is resolved, without blocking. πŸ’…


🌸 SYNOPSIS 🌸

#include <SDL3_net/SDL_net.h>

NET_Status NET_GetAddressStatus(NET_Address *address);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea β˜•: the NET_Address objects you get back from NET_ResolveHostname take time to do their thing. like, actual real-world time, because DNS is out here living its life. so instead of making your whole program sit there waiting an indefinite amount of time like a sad little NPC, it does its work asynchronously. 🫢

this function right here? it lets you check the progress of that work without blocking. literally just a little vibe check on your address. πŸ”

⚠️ important bestie: resolution can fail after some time (DNS server took a while to reply that the hostname isn't recognized, etc.), so be sure to check the result of this function instead of just assuming it worked because it's non-zero! 😭 no cap, that's how you get bugs.

once an address is successfully resolved, it can be used to connect to the host represented by the address. periodt. πŸ‘‘


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • address β€” the NET_Address you wanna query. that's it, that's the whole vibe. πŸ’–

⭐ RETURN VALUE ⭐

  • NET_SUCCESS β€” yay! successfully resolved. slay. ✨
  • NET_FAILURE β€” resolution failed. πŸ’€ if you get this, call SDL_GetError() for details.
  • NET_WAITING β€” still resolving, bestie. this function timed out without resolution. give it a sec. ⏳

πŸ”₯ THREAD SAFETY πŸ”₯

it is safe to call this function from any thread. go off, multithreaded icon. πŸ§΅πŸ‘‘


🌈 AVAILABILITY 🌈

this function is available since SDL_net 3.0.0. vintage but make it fresh. πŸ’œ


πŸ‘‘ SEE ALSO πŸ‘‘


mwah πŸ’‹ that's the whole page, diva. this was SDL_net 3.2.0, brought to you by the SDL_net girlies, and you absolutely ate this documentation. no notes. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from