sock_listen(3z)

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

πŸ’– 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 function handler vary depending on whether the socket is of type prot_UDP or prot_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