LC_SEND(3)
π LC_SEND β send data over multicast π
okay bestie, so this is a page from the Librecast Programmer's Manual, section 3 (LC_SEND(3)). yes it's giving "networking homework" but honestly? it ate. let's get into it π¦
πΈ NAME πΈ
lc_sendtree, lc_sendchunk β send data over multicast. that's the whole vibe. no cap.
β¨ LIBRARY β¨
Librecast library (liblibrecast, -llibrecast). that's your girl, that's the whole squad π
π SYNOPSIS π
okay so first things first, you gotta invite her in:
#include <librecast/sync.h>
and then these three icons walk in:
ssize_t lc_sendtree(lc_ctx_t *lctx, unsigned char *hash, const mtree_t *tree,
lc_stat_t *stats, lc_sync_options_t *opt, int flags);
ssize_t lc_sendchunk(lc_ctx_t *lctx, unsigned char *hash, const void *data,
const size_t len, lc_stat_t *stats, lc_sync_options_t *opt, int flags);
ssize_t lc_senddir(lc_ctx_t *lctx, unsigned char *hash, net_tree_t *dir,
lc_stat_t *stats, lc_sync_options_t *opt, int flags);
and when you build, you link her up like:
Compile and link with -llibrecast.
periodt. π
π DESCRIPTION π
every single one of these functions does the same main-character move: it sends data over multicast on the librecast channel that gets formed from the hash you handed it. like, the hash is the address, iykyk.
LCRQ (RaptorQ) encoding is used when sending. and for trees where the receiver has no idea how long the thing is? π those include an OTI header (RaptorQ FEC Object Transmission Information header β see RFC 6330) with each packet. so the receiver isn't just guessing, bestie, she's informed. π
sending continues in a loop until the calling thread is cancelled. she will keep going. she does not stop. she is loyal like that π
the lc_sendtree function sends the merkle tree structure tree on channel hash. the lc_sendchunk function sends len bytes of data. both iconic, both necessary, no notes.
the lc_senddir function is a wrapper for lc_sendtree(3) which sends a directory object and adjusts the sending size to account for the directory data. she's the little sister who does the extra math so you don't have to π«Ά
if stats is not NULL, transfer statistics will be returned in this structure. receipts! we love receipts. β¨
opt is not used, at present, and must be NULL for compatibility with future versions. so likeβ¦ don't touch it. it's not ready yet. respect the boundary π
π the flags argument π
flags is the bitwise OR of zero of more of the following flags. yes, zero is allowed, she's flexible:
LC_SHARE_LOOPBACKβ Set the loopback optionIPV6_MULTICAST_LOOPon the sending socket. basically: let her hear herself. π§
π₯ RETURN VALUE π₯
these calls return the number of bytes received, or -1 if an error occurred. and if an error did occur? errno is set to indicate the error. so check your errno, bestie, she's trying to tell you something π
π ERRORS π
EINVALβ Invalid argument. you gave her something she cannot work with. respectfully.ENOMEMβ Not enough space/cannot allocate memory (POSIX.1-2001). the memory said no. it's not you, it's the RAM. π
π¦ SEE ALSO π¦
lc_ctx_new(3), lc_share(3), lc_sendtree(3), lc_sendchunk(3) β go read those next, they're literally the rest of the lore π
and that's the whole page, bestie!! mwah π this one's from the Librecast crew, dated 2025-06-09, published under the LIBRECAST banner for manual page LC_SEND(3). go forth and multicast responsibly. slay. β¨ππ
π¦ 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