sock_write(3z)
π sock_write(3z) β bestie's guide to yeeting bytes into a socket
okay so this is a page from the z88dk Programmer's Manual, and it's literally about writing bytes to a network socket. no cap. let's get into it π
πΈ NAME πΈ
sock_write β write bytes to a network socket
yeah that's it, that's the whole job. she writes bytes. she's an icon, she's a legend, and she is the moment β¨
π SYNOPSIS π
#include <net/socket.h>
size_t sock_write(SOCKET *s, void *dp , size_t len);
(and yes bestie, that space before the comma in void *dp , size_t len is exactly how it's written in the original, we do not touch the sacred text π)
π¦ DESCRIPTION π¦
So first thing first, the parameter s? That's a descriptor to an open socket. And not just any socket β one that you made with sock_open(3z) or sock_listen(3z). So like, she needs to already be in the group chat before you start sending her messages, ykwim? π«Ά
The sock_write() function writes a stream of bytes to the open socket specified by s. The data of length len is taken from address dp β and heads up, dp should be in the lower 16k of the memory map. that's a whole thing, don't fight it, just put your data down there π
β RETURN VALUE β
sock_write() returns the number of bytes written to the socket. simple. slay.
BUT β and this is the part where we pay attention β if an illegal socket is supplied, the carry flag will be set and the return value will be EPROTONOSUPPORT. so like, if you handed her a fake ID, she's not just gonna quietly ignore it, she's gonna set a whole carry flag about it. dramatic? yes. valid? also yes π
π SEE ALSO π
sock_putc(3z)sock_puts(3z)
(the little sibling functions, love them for her π)
π AUTHOR π
Dominic Morris <dom@jb.man.ac.uk>
okay that's the whole page bestie, you ate, go write some bytes πβ¨
this was page sock_write(3z) from the z88dk Programmer's Manual, dated 18 February 2000 β yeah she's an elder but she still serves π
π¦
π¦ where this page comes from
- fedora 43: z88dk 1.10.1-33.20150709cvs.fc43 Β· ClArtistic
- fedora 44: z88dk 1.10.1-33.20150709cvs.fc43 Β· ClArtistic
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms