---
name: "lc_recv"
section: "3"
platform: "linux"
package: "liblibrecast-dev"
version: "0.9.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/lc_recv"
---

# lc\_recv(3)

receive data over multicast

## NAME

lc\_recvtree, lc\_recvchunk - 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***);**

Compile and link with *-llibrecast*.

## DESCRIPTION

Each of these functions receives data over multicast by joining the librecast channel formed from the supplied *hash*.

The **lc\_recvtree** function receives the merkle tree structure from channel *hash* into *tree*.

The **lc\_recvchunk** function receives a chunk of data of length *len* (which can be fragmented over several packets) from channel *hash*, writing it into the memory pointed to by *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.

*flags* is not used, at present, and must be zero for compatibility with future versions.

## RETURN VALUE

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.

## ERRORS

- **EINVAL**

  Invalid argument.

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

## SEE ALSO

**[lc\_ctx\_new(3)](/lc_ctx_new/3.md),** [**lc\_share**(3)](/lc_share/3.md), [**lc\_sendtree**(3)](/lc_sendtree/3.md), [**lc\_sendchunk**(3)](/lc_sendchunk/3.md)
