socket_tcp4(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 β€” ip and p are yours to fill in, this page is not out here telling you what values to use 😭

πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, bestie!! 🫢 this was socket_tcp4(3) from the Library Functions Manual β€” go forth and socket responsibly. mwah πŸ’‹βœ¨