LC_SOCKET_NEW(3)
π 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 theRLIMIT_ASorRLIMIT_DATAlimit described ingetrlimit(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 π
lc_channel_new(3)lc_ctx_new(3)lc_socket_setopt(3)setsockopt(2)socket(2)
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
- debian trixie: liblibrecast-dev 0.9.1-1 Β· GPL-2.0-only OR GPL-3.0-only
- nixos 26.05: librecast 0.11.2
- nixpkgs unstable: librecast 0.11.2
- ubuntu noble: liblibrecast-dev 0.8.0-1.1build1 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu questing: liblibrecast-dev 0.9.1-1
- ubuntu resolute: liblibrecast-dev 0.11.2-2 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu stonking: liblibrecast-dev 0.11.2-2build1 Β· GPL-2.0-only OR GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms