.TH LC_RECV 3 2023-08-02 "LIBRECAST" "Librecast Programmer's Manual" .SH NAME lc_recvtree, lc_recvchunk \- receive data over multicast .SH LIBRARY Librecast library .RI ( liblibrecast ", " \-llibrecast ) .SH SYNOPSIS .nf .B #include .PP .BI "ssize_t lc_recvtree(lc_ctx_t " *lctx ", unsigned char " *hash ", mtree_t " *tree " .BI " lc_stat_t " *stats ", lc_sync_options_t " *opt ", int " flags ");" .BI "ssize_t lc_recvchunk(lc_ctx_t " *lctx ", unsigned char " *hash ", void " *data ", const size_t " len " .BI " lc_stat_t " *stats ", lc_sync_options_t " *opt ", int " flags ");" .fi .PP Compile and link with \fI\-llibrecast\fP. .SH DESCRIPTION Each of these functions receives data over multicast by joining the librecast channel formed from the supplied .IR hash . .PP The .BR lc_recvtree function receives the merkle tree structure from channel .IR hash into .IR tree . .PP The .BR lc_recvchunk function receives a chunk of data of length .IR len (which can be fragmented over several packets) from channel .IR hash , writing it into the memory pointed to by .IR data . .PP If .IR stats is not NULL, transfer statistics will be returned in this structure. .PP .IR opt is not used, at present, and must be NULL for compatibility with future versions. .PP .IR flags is not used, at present, and must be zero for compatibility with future versions. .PP .SH RETURN VALUE These calls return the number of bytes received, or -1 if an error occurred. In the event of an error, .I errno is set to indicate the error. .SH ERRORS .TP .BR EINVAL Invalid argument. .PP .BR ENOMEM Not enough space/cannot allocate memory (POSIX.1-2001). .PP .SH SEE ALSO .BR lc_ctx_new(3), .BR lc_share (3), .BR lc_sendtree (3), .BR lc_sendchunk (3)