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

# lc\_sendchunk(3)

send data over multicast

Part of [lc\_send(3)](/lc_send/3.md).

## NAME

lc\_sendtree, lc\_sendchunk - send data over multicast

## LIBRARY

Librecast library (*liblibrecast*, *-llibrecast*)

## SYNOPSIS

```
#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*.

## DESCRIPTION

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:

- **LC\_SHARE\_LOOPBACK**

  Set the loopback option *IPV6\_MULTICAST\_LOOP* on the sending socket.

## 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)
