socket_tcp4(3)
π socket_tcp4 β bestie's guide to non-blocking TCP/IP stream sockets π
okay so real talk, this is page socket_tcp4(3) from the Library Functions Manual and it's literally the cutest little socket-maker in libowfat. no cap.
β¨ NAME β¨
socket_tcp4 β create a non-blocking TCP/IP stream socket π¦
πΈ SYNTAX πΈ
#include <libowfat/socket.h>
int socket_tcp4();
π DESCRIPTION π
okay so here's the vibe: socket_tcp4 creates a non-blocking TCP/IP stream socket and hands you back a file descriptor pointing right at it. that's it. that's the whole job. she's simple, she's iconic, she does one thing and she does it well π
and if something goes wrong? if the universe simply said "not today"? then socket_tcp4 returns -1 and sets errno appropriately. and the best part β the girlboss move β she does this without allocating any resources. no mess, no cleanup, no lingering messiness. we love a clean exit fr fr π
π EXAMPLE π
okay bestie here's how you actually use her:
#include <libowfat/socket.h>
int s;
char ip[4];
uint16 p;
s = socket_tcp4();
socket_bind4(s,ip,p);
socket_connect4(s,ip,p);
like... make the socket, bind it, connect it. the holy trinity. it's giving β¨main character energyβ¨
ngl the example is literally just the shape of it βipandpare yours to fill in, this page is not out here telling you what values to use π
π₯ SEE ALSO π₯
socket_tcp4b(3)β her sibling, go say hisocket_bind4(3)β the binder, step two of the trinitysocket_bind6(3)β the IPv6 version, bc we contain multitudes π
and that's the whole page, bestie!! π«Ά this was socket_tcp4(3) from the Library Functions Manual β go forth and socket responsibly. mwah πβ¨
π¦ 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