NET_ResolveHostname(3)
π NET_ResolveHostname π
okay bestie, welcome to the SDL_net3 FUNCTIONS section of the manual, and today's main character is NET_ResolveHostname β the girl who takes your cute lil human-readable hostname and turns it into something the computer can actually vibe with. π¦
β¨ NAME β¨
NET_ResolveHostname β resolve a human-readable hostname.
β¨ SYNOPSIS β¨
#include <SDL3_net/SDL_net.h>
NET_Address * NET_ResolveHostname(const char *host);
β¨ DESCRIPTION β¨
so like. SDL_net does not do human-readable hostnames (things like www.libsdl.org, you know, the cute ones) β it operates on computer-readable addresses instead. This function is the glow-up translator between the two. That whole process? It's called "resolving" an address. π
You can also use this to turn IP address strings (like "159.203.69.7") into NET_Address objects. versatile queen fr fr.
β οΈ lowkey important: resolving an address is an asynchronous operation, because the library has to go ask a server on the internet for the info it needs, and that can take time (and possibly fail later, not now π). This function will not block. It either returnsNULL(catastrophic failure, we're sobbing) or an unresolvedNET_Address. And until the address actually resolves, it can't be used. periodt.
If you want to block until the resolution is finished, you can call NET_WaitUntilResolved(). Otherwise, you can do a non-blocking check with NET_GetAddressStatus(). pick your fighter π«Ά
When you are done with the returned NET_Address, call NET_UnrefAddress() to dispose of it. And yes, you need to do this even if resolution later fails asynchronously. no take-backs, no skipping, that's the rule. π
β¨ FUNCTION PARAMETERS β¨
hostβ the hostname to resolve. π
β¨ RETURN VALUE β¨
Returns a new NET_Address on success, NULL on error; call SDL_GetError() for details. (aka the receipts. always read the receipts.) π
β¨ THREAD SAFETY β¨
It is safe to call this function from any thread. π multitasking icon behavior, no cap.
β¨ AVAILABILITY β¨
This function is available since SDL_net 3.0.0. it's been here, it's been iconic. π
β¨ SEE ALSO β¨
and that's the whole page bestie!! π§ this was pulled from the SDL_net manual, version SDL_net 3.2.0, and yes it was giving NET_ResolveHostname(3) the entire time. slay, go resolve something, mwah ππΈ
π¦ where this page comes from
- fedora 43: SDL3_net-devel 3.2.0-2.fc43 Β· Zlib
- fedora 43: SDL3_net-devel 3.2.0-2.fc43 Β· Zlib
- fedora 44: SDL3_net-devel 3.2.0-2.fc44 Β· Zlib
- fedora 44: SDL3_net-devel 3.2.0-2.fc44 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms