NET_GetStreamSocketAddress(3)
π NET_GetStreamSocketAddress π
okay bestie, this one lives in the SDL_net3 FUNCTIONS section of the manual, and it's genuinely one of the handiest little guys in the whole networking toolbox π«Ά
β¨ NAME β¨
NET_GetStreamSocketAddress β get the remote address of a stream socket. yes, the remote one, the other side of the call, the person on the phone πβ¨
πΈ SYNOPSIS πΈ
#include <SDL3_net/SDL_net.h>
NET_Address * NET_GetStreamSocketAddress(NET_StreamSocket *sock);
π¦ DESCRIPTION π¦
So like. This function reports the address of the remote side of a stream socket. And here's the tea: that remote side might still be pending connection. Not fully connected yet, still getting ready, still doing its little warm-up stretch π§ β and this function will still tell you what address it's headed for.
π IMPORTANT BESTIE: this adds a reference to the address. That means the caller _must_ call NET_UnrefAddress() when done with it. Not "should", not "maybe", must. You took a reference, you give it back. No cap. π
π FUNCTION PARAMETERS π
sockβ the stream socket to query. that's the one you're asking about π
β RETURN VALUE β
Returns the socket's remote address, or NULL on error β and if you get NULL, call SDL_GetError() for the details, because it will absolutely tell you what went wrong π
π THREAD SAFETY π
It is safe to call this function from any thread. every thread. all of them. go wild, main character energy, no locks needed π β¨
π AVAILABILITY π
This function is available since SDL_net 3.0.0. so if you're on something olderβ¦ girl. upgrade. π
and that's the whole page, mwah π thanks for reading, you're doing amazing sweetie, now go unref that address π«Ά
β with love from the SDL_net 3.2.0 era β¨ππ¦ (that's the source + version stamped on this page, and if you were wondering about a date, bestie, the footer didn't give us one β just the version and that gorgeous SDL_net name π)
π¦ 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