sock_close(3z)

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

πŸ’– sock_close β€” the manual, but make it slay ✨

okay bestie, welcome to the z88dk Programmer's Manual glow-up edition, where we're talking about sock_close(3z) β€” yes, that's the one in the 3z section, the C library zone. it's giving "closing time, doors are shutting, but respectfully" πŸšͺ✨


🌸 NAME 🌸

sock_close β€” close a network connection 🫢

like, say goodbye. hang up. end the call. it's over (but politely).


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <net/socket.h>

void sock_close(SOCKET *s);

that's it. that's the whole vibe. one function, one pointer, zero return value. icon behaviour honestly πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

so the parameter s? it's a descriptor to an open socket β€” and it's gotta be one that was made with sock_open(3z) or sock_listen(3z). no making up sockets out of thin air, bestie, that's not the move 😭

the sock_close() function will initiate a close on the socket specified by s. once you've called this function, no more data can be written to the socket. periodt. the write era is OVER. 🚫✍️

but β€” and this is the plot twist β€” if the socket is of type prot_TCP, then data can continue to be read. so like, the talking-into-the-void part is done, but you can still listen. reading main character energy only. πŸ‘‘

lowkey important: this is a close being initiated, and the write-shutoff is immediate. don't be out here trying to write after you've called it, you will simply not be writing. πŸ™ˆ

✨ RETURN VALUE ✨

None. nada. nothing. it returns void and it means it. no status code to check, no vibes to interpret β€” it just does the thing. πŸ’€


🌈 SEE ALSO 🌈

  • sock_abort(3z) β€” the dramatic exit 😀
  • sock_shutdown(3z) β€” the other shutdown-ish situation

go read those too, iykyk. 🧚


πŸ’œ AUTHOR πŸ’œ

Dominic Morris <dom@jb.man.ac.uk> β€” the og, the legend, the one who wrote the thing πŸ‘‘


and that's the whole page, bestie!! this lil masterpiece comes straight out of the z88dk Programmer's Manual, and the date on it is 18 February 2000 β€” vintage, retro, still iconic. sock_close(3z) forever. mwah πŸ’…πŸ’–βœ¨πŸŒΈπŸ¦‹πŸŽ€

πŸ“¦ where this page comes from