sock_listen(3z)
π sock_listen(3z) π
okay bestie, so this one lives in the z88dk Programmer's Manual and it's literally about opening a passive network connection. passive as in listening, not passive as in "not texting back" π . let's get into it.
β¨ NAME β¨
sock_listen β open a passive network connection π«Ά
πΈ SYNOPSIS πΈ
#include <net/socket.h>
SOCKET *sock_listen(ipaddr_t ipdest, tcpport_t lport,
void (*handler)(), char proto);
π¦ DESCRIPTION π¦
so sock_listen() makes you a socket descriptor for a passive connection β aka a listening one β sitting on your local port lport, just chilling and awaiting a connection from host ipdest. main character energy, honestly. π
at the moment, only protocols prot_UDP and prot_TCP are supported. that's it. that's the list. no cap.
if you wanna accept connections from literally any host, just pass 0L as the ipdest parameter. open door policy, we love to see it. π
the handler parameter is a handler that gets called whenever the connection changes state or new data arrives. it should be the code for a package routine. β¨
heads up: the input parameters of the functionhandlervary depending on whether the socket is of typeprot_UDPorprot_TCP. so like, don't assume they're the same, bestie. π
β RETURN VALUE β
sock_listen() returns a socket descriptor. π
but if you specify a non support protocol? yeah, the carry flag gets set and the return value is EPROTONOSUPPORT. not the vibe. π
π₯ SEE ALSO π₯
sock_open(3z)
π AUTHOR π
Dominic Morris <dom@jb.man.ac.uk>
and that's the whole page, bestie!! this iconic lil doc came to us from the 18 February 2000 era, filed under sock_listen(3z) in the z88dk Programmer's Manual. periodt. πβ¨π
π¦ 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