LC_RECV(3)
π LC_RECV(3) π
ok so bestie, we're in the Librecast Programmer's Manual rn and this page is literally all about receiving data over multicast. the manual name is LC_RECV and it's section 3, iykyk. sit down, hydrate, let's go π«Ά
β¨ NAME β¨
lc_recvtree, lc_recvchunk, lc_recvdir β receive data over multicast
π LIBRARY π
Librecast library (liblibrecast, -llibrecast)
πΈ SYNOPSIS πΈ
#include <librecast/sync.h>
ssize_t lc_recvtree(lc_ctx_t *lctx, unsigned char *hash, mtree_t *tree,
lc_stat_t *stats, lc_sync_options_t *opt, int flags);
ssize_t lc_recvchunk(lc_ctx_t *lctx, unsigned char *hash, void *data, const size_t len,
lc_stat_t *stats, lc_sync_options_t *opt, int flags);
ssize_t lc_recvdir(lc_ctx_t *lctx, unsigned char *hash, net_tree_t **dir,
lc_stat_t *stats, lc_sync_options_t *opt, int flags);
Compile and link with -llibrecast. π
π¦ DESCRIPTION π¦
ok so every single one of these functions does the same iconic thing at its core: it receives data over multicast by joining the librecast channel that gets formed from the hash you hand it. that's the vibe. that's the whole assignment. β¨
lc_recvtree β this one receives the merkle tree structure from channel hash and puts it into tree. tree girlies, this is your moment π³
lc_recvchunk β this one receives a chunk of data of length len from channel hash, and writes it into the memory pointed to by data. and bestie, len can be fragmented over several packets β she's flexible like that, no stress π
lc_recvdir β this one is a wrapper for lc_recvtree(3) and it's a little picky, ngl. if the object it received is not a directory, it returns -1 and sets errno to ENOTDIR. she said directory only, respectfully π«π
now for the little details that matter:
- if
statsis notNULL, the transfer statistics will be returned in that structure. so if you want the receipts, pass it in π§Ύ optis not used, at present, and it must beNULLfor compatibility with future versions. don't be cute, just passNULLπ«flagsis not used, at present, and it must be zero for compatibility with future versions. zero. that's it. that's the number π₯
fr fr:optmust beNULLandflagsmust be zero. this is for compatibility with future versions, so don't try to be clever and sneak something else in there, it's giving undefined chaos energy π
β RETURN VALUE β
these calls return the number of bytes received, or -1 if an error occurred. and if there's an error? errno gets set to tell you what went wrong. she always leaves a note π
π ERRORS π
EINVALβ Invalid argument. you gave her something she can't work with πENOMEMβ Not enough space/cannot allocate memory (POSIX.1-2001). the memory said no πENOTDIRβ Not a directory.lc_recvdirsaid what she said πβ
π SEE ALSO π
lc_ctx_new(3), lc_share(3), lc_sendtree(3), lc_sendchunk(3)
ok that's the whole page bestie, you ate that πβ¨ this was the Librecast manual, dated 2025-06-09, and you just finished reading LC_RECV(3). go forth and receive, main character π
ππ¦
π¦ where this page comes from
- nixos 26.05: librecast 0.11.2
- nixpkgs unstable: librecast 0.11.2
- 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