LC_SOCKET_NEW(3)

πŸ“¦
version 0.11.2 Β· 2 versions
  • 0.11.2 Β· debian trixie, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.5.1 Β· debian bookworm
, in debian trixie, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– lc_socket_new(3) β€” the Librecast Programmer's Manual, but make it cute πŸ’–

okay bestie, so you're out here in the Librecast universe and you need a socket. this page is literally about making one and yeeting it when you're done. it lives in the Librecast Programmer's Manual, and it's giving "small page, big power" energy. ✨


πŸ“š LIBRARY πŸ“š

Librecast library β€” that's liblibrecast, and you link it with -llibrecast. 🫢


✨ SYNOPSIS ✨

#include <librecast/net.h>

lc_socket_t *lc_socket_new(lc_ctx_t *ctx);
void lc_socket_close(lc_socket_t *sock);

and like, don't forget: compile and link with -llibrecast. no cap. πŸ”₯


🌸 DESCRIPTION 🌸

lc_socket_new() creates a brand new Librecast socket. iconic behavior honestly. when you're done with it, call lc_socket_close(3). that's the whole vibe. πŸ’…

plot twist tho β€” sockets can <em>also</em> get freed by calling lc_ctx_free(3) on the Librecast context, and that call will free the context <strong>and all associated sockets and channels</strong> along with it. it's a package deal, bestie. πŸŽ€

also on the roster: lc_socket_free() closes and frees a Librecast socket created with lc_socket_new(3). πŸ¦‹


πŸ’« RETURN VALUE πŸ’«

lc_socket_new() hands you back a pointer to a lc_socket_t handle. that's your new baby. πŸ‘‘

but if things go sideways? it returns NULL and sets errno. so yeah, check for NULL, okay? 😭

the lc_socket_close() function returns no value. nothing. void. it simply does the thing and leaves. main character energy fr fr. πŸ’€


⚠️ ERRORS ⚠️

lc_socket_new() can fail with these, so buckle up:

  • ENOMEM β€” Out of memory. possibly your application hit the RLIMIT_AS or RLIMIT_DATA limit described in getrlimit(2). (translation: your process asked for too much, and the system said no. πŸ™ˆ)

and heads up β€” lc_socket_new() could <em>also</em> fail with any of the errors listed in socket(2) or setsockopt(2). so if you're confused, go read those. iykyk. 🌈


πŸ‘€ SEE ALSO πŸ‘€


and that's the page!! this one's from the <strong>LIBRECAST</strong> crew, dated <strong>2021-02-21</strong>, and it goes by <strong>LC_SOCKET_NEW(3)</strong>. go make some sockets, bestie. slay. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from