NET_DestroyDatagramSocket(3)

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

πŸ’– NET_DestroyDatagramSocket(3) πŸ’–

okay bestie, we're in the SDL_net3 corner of the manual, and this one is literally the goodbye function. it's NET_DestroyDatagramSocket, and it does exactly what it says on the tin: it disposes of a datagram socket you already made earlier. no cap. 🫢


✨ NAME ✨

NET_DestroyDatagramSocket β€” dispose of a previously-created datagram socket. that's it, that's the whole job. it's giving closure. 🌈


🌸 SYNOPSIS 🌸

#include <SDL3_net/SDL_net.h>

void NET_DestroyDatagramSocket(NET_DatagramSocket *sock);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, and it's important tea: this function will _abandon_ any data that's queued up for sending but hasn't actually made it out to the socket yet. gone. poof. not me emotionally detaching from your unsent packets 😭

if you need that data to arrive, you have to wait for some kind of confirmation from the remote computer β€” and that confirmation is something you have to devise yourself, because the library isn't gonna do it for you. and listen: queued data isn't guaranteed to arrive even if the library made efforts to transmit it here. so like, don't come for the library, it tried its best. πŸ’…

also, any data that already arrived from the remote end of the connection but hasn't been read yet? that's lost too. not "delayed", not "saved for later" β€” lost. it's giving main character exit, no looking back. πŸŽ€


πŸ‘‘ FUNCTION PARAMETERS πŸ‘‘

  • sock β€” the datagram socket you're destroying. bye boo, you were iconic. ✨

πŸ’œ THREAD SAFETY πŸ’œ

do not operate on the same socket from multiple threads at the same time unless you're supplying a serialization mechanism. like, don't. πŸ™ˆ

that said, different threads can access different sockets at the same time with zero problems. so like, everyone gets their own toy, no fighting. 🧚


⭐ AVAILABILITY ⭐

this function has been available since SDL_net 3.0.0. old money, lowkey. πŸ“


πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, fr fr. go read them, iykyk. πŸ’–


reminder bestie: destroying the socket is permanent. unread incoming data = gone, unconfirmed queued outgoing data = gone. if that matters to you, handle it before you call this. periodt. πŸ’€

and that's the page!! this manual came to you from SDL_net, version SDL_net 3.2.0, so if you see it out in the wild, that's the vibe check. slay, stay safe, and always read your man pages before you yeet a socket. πŸ‘‘πŸ’…βœ¨

πŸ“¦ where this page comes from