sock_closed(3z)

πŸ“¦ version 1.10.1, in fedora 43, fedora 44

✨ sock_closed ✨

okay so bestie, real talk β€” this is the z88dk Programmer's Manual and we're talking about sock_closed(3z), which is literally just the "is this socket ghosting me?" detector πŸ’…


🌸 NAME 🌸

sock_closed β€” test whether a network connection is closed


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <net/socket.h>

bool_t sock_closed(SOCKET *s);

πŸ’– DESCRIPTION πŸ’–

So. The parameter s? That's a descriptor to a socket. And not just any socket β€” one you made with sock_open(3z) or sock_listen(3z). Those are the only ones invited to this party, no random sockets showing up unannounced πŸ’€

What sock_closed() does is test whether a socket is closed β€” and yes, "closed" here means exactly what you think. Either the connection to a remote host was never established in the first place, or it already got closed by the kernel. Either way, it's giving "this link is not it" 😭

Heads up though: a socket of prot_UDP is never closed. Like, never ever. UDP said "I'm not leaving" and honestly? Respect. 🫢

πŸŽ€ RETURN VALUE πŸŽ€

sock_closed() returns TRUE or FALSE. That's it. That's the whole vibe check. ⭐


🌈 SEE ALSO 🌈

  • sock_opened(3z) β€” the other half of the duo, iykyk

πŸ‘‘ AUTHOR πŸ‘‘

Dominic Morris <dom@jb.man.ac.uk> β€” the icon who wrote this, we stan 🫢


and that's the whole page, bestie!! this one came from the z88dk Programmer's Manual, dated 18 February 2000 β€” yes she's vintage, yes she still slays, periodt πŸ’œβœ¨

πŸ“¦ where this page comes from