sock_read(3z)

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

πŸ’– sock_read(3z) πŸ’–

okay bestie, welcome to z88dk Programmer's Manual β€” yes we're reading a manpage for fun, and yes it's gonna slay 🫢


✨ NAME ✨

sock_read β€” read bytes from a network socket πŸŒπŸ’«


✨ SYNOPSIS ✨

#include <net/socket.h>

size_t sock_read(SOCKET * s, void * dp , size_t len);

✨ DESCRIPTION ✨

so like, the parameter s? that's a descriptor to an open socket that you made earlier with sock_open(3z) or sock_listen(3z). you can't just rock up with a random socket, it has to be one of those two, iykyk πŸ’…

and then sock_read() does the thing: it reads at most len bytes from the socket s and drops them at dp. cute right? it's giving "delivery service but for bytes" πŸ“¦βœ¨

heads up bestie: dp should be in the lower 16k of the memory map. like, don't be putting it anywhere else, fr fr 😭 that's a real constraint, not a vibe suggestion.

✨ RETURN VALUE ✨

sock_read() returns the number of bytes read from the socket. that's it, that's the number 🌸

but β€” and this is the part where you go πŸ’€ β€” if you supply an illegal socket, the carry flag will be set, and the return value will be EPROTONOSUPPORT. so like, check your sockets before you ship, no cap.


✨ AUTHOR ✨

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


and that's the whole page bestie, you ate it up πŸ’…πŸŽ€

z88dk Programmer's Manual Β· sock_read(3z) Β· 18 February 2000 β€” yeah she's an oldie but she's iconic, periodt πŸ’–πŸŒˆ

πŸ“¦ where this page comes from