sock_putc(3z)

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

πŸ’– sock_putc β€” the manual, but make it cute πŸ’–

okay so this is a page from the z88dk Programmer's Manual, and it's all about sock_putc(3z) β€” one lil byte, one big vibe. let's get into it πŸ¦‹


✨ NAME ✨

sock_putc β€” write byte to a network socket

yes bestie, ONE byte. singular. we're being precise today πŸ’…


✨ SYNOPSIS ✨

#include <net/socket.h>

size_t sock_putc(char c, SOCKET *s);

look at that signature. clean. iconic. no notes. πŸŽ€


✨ DESCRIPTION ✨

so the parameter s is a descriptor to an open socket β€” and not just any socket, one you made with sock_open(3z) or sock_listen(3z). gotta have it open first, no shortcuts, no cap πŸ”₯

then sock_putc() does its one job and its one job only: it writes a single byte c to the socket you specified with s. that's it. that's the whole function. main character energy, minimal plot 🫢


✨ RETURN VALUE ✨

so the return value here is the number of bytes written to the socket β€” which, given that we're writing literally one byte, means it's 0 or 1. very binary of it πŸ’€

okay heads up, the page literally says "The sock_write() function returns…" in this section β€” not sock_putc(). i'm quoting it exactly as written because that's the rule, and i am nothing if not a rule-follower when it comes to facts πŸ™ˆ

and if you hand it an illegal socket? the carry flag gets set, and the return value will be EPROTONOSUPPORT. so yeah. don't do that. vibe check failed, bestie 😭


✨ SEE ALSO ✨

  • sock_write(3z)
  • sock_puts(3z)

go read those too, they're giving the same energy fr fr 🌸


✨ AUTHOR ✨

Dominic Morris <dom@jb.man.ac.uk> β€” the legend, the moment, the author πŸ‘‘


and that's a wrap, gorgeous πŸ’œ this was the z88dk Programmer's Manual edition of sock_putc(3z), dated 18 February 2000 β€” yes, a vintage queen from the year 2000, still slaying ✨🌈 bye bestie, go write exactly one byte πŸŽ€

πŸ“¦ where this page comes from