socket_listen(3)
π socket_listen β bestie's guide to opening the door π
okay so this page is socket_listen(3), and it lives in the Library Functions Manual section of the libowfat docs. pull up a chair, we're learning how to make your lil TCP socket start accepting friends π«Ά
β¨ NAME β¨
socket_listen β the manpage literally says "attempt to make a TCP connection", which, no shade, is not quite what it does (it's the listening side, bestie), but that's what's written so that's what you get π
π SYNTAX π
#include <libowfat/socket.h>
int socket_listen(int s,int n);
πΈ DESCRIPTION πΈ
so socket_listen gets your TCP socket s all dolled up to accept TCP connections π it lets a backlog of approximately n TCP SYNs hang out in the queue.
heads up: on systems that support SYN cookies, the backlog is irrelevant. the kernel's doing its own thing and your n is just vibing. no cap.
normally, socket_listen returns 0. slay, standard.
but if anything goes wrong? it returns -1 and sets errno appropriately so you know exactly what happened. not me being a responsible API π
π¦ EXAMPLE π¦
here's the whole vibe, copy-paste ready:
#include <libowfat/socket.h>
int s;
char ip[16];
uint16 p;
if ((s=socket_tcp6())==-1)
strerr_die2sys(111,FATAL,"unable to create TCP socket: ");
if (socket_bind6_reuse(s,(char *)V6any,8002,0) == -1)
strerr_die2sys(111,FATAL,"unable to bind: ");
if (socket_listen(s,1) == -1)
strerr_die2sys(111,FATAL,"unable to listen: ");
create it, bind it, listen on it. three steps, main character energy, periodt β¨
π SEE ALSO π
(the other side of the convo, iykyk π§)
and that's the whole page, bestie π this was pulled from the Library Functions Manual for libowfat, and the lil footer at the bottom is just the page signing off as socket_listen(3) β no version number, no date, just a name drop π go forth and listen ππ₯
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms