Scroll to navigation

LC_SEND(3) Librecast Programmer's Manual LC_SEND(3)


lc_sendtree, lc_sendchunk - send data over multicast


Librecast library (liblibrecast, -llibrecast)


#include <librecast/sync.h>
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);

Compile and link with -llibrecast.


Each of these functions sends data over multicast on the librecast channel formed from the supplied hash. LCRQ (RaptorQ) encoding is used when sending. Trees, for which the length is not known by the receiver, include an OTI header (RaptorQ FEC Object Transmission Information header - see RFC 6330) with each packet.

Sending continues in a loop until the calling thread is cancelled.

The lc_sendtree function sends the merkle tree structure tree on channel hash. The lc_sendchunk function sends len bytes of data.

If stats is not NULL, transfer statistics will be returned in this structure.

opt is not used, at present, and must be NULL for compatibility with future versions.

The flags argument is the bitwise OR of zero of more of the following flags:

Set the loopback option IPV6_MULTICAST_LOOP on the sending socket.


These calls return the number of bytes received, or -1 if an error occurred. In the event of an error, errno is set to indicate the error.


Invalid argument.

ENOMEM Not enough space/cannot allocate memory (POSIX.1-2001).


lc_ctx_new(3), lc_share(3), lc_sendtree(3), lc_sendchunk(3)

2023-08-02 LIBRECAST