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

# lc\_ctx\_ratelimit(3)

set send/recv ratelimits

## NAME

lc\_ctx\_ratelimit, lc\_channel\_ratelimit - set send/recv ratelimits

## LIBRARY

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

## SYNOPSIS

```
#include <librecast/net.h>
```

**void lc\_ctx\_ratelimit(lc\_ctx\_t** *\*ctx***, size\_t** *bps\_out***, size\_t** *bps\_in***);** **void lc\_channel\_ratelimit(lc\_channel\_t** *\*chan***, size\_t** *bps\_out***, size\_t** *bps\_in***);**

Compile and link with *-llibrecast*.

## DESCRIPTION

The **lc\_ctx\_ratelimit** function sets the default ratelimits for subsequent sockets and channels created with context *ctx*.

*bps\_out* and *bps\_in* specify the ratelimits in bits per second for outbound (send) and inbound (recv) respectively. These limits are applied to future sockets and channels created with [**lc\_socket\_new**(3)](/lc_socket_new/3.md) and **lc\_channel\_new**(3). Existing sockets and channels are unaffected.

[**lc\_channel\_ratelimit**(3)](/lc_channel_ratelimit/3.md) sets the rate limits for channel *chan* similarly.

## RETURN VALUE

These functions return no value.

## ERRORS

None.

## NOTES

Only the send limit is enforced at this time.

## SEE ALSO

[**lc\_ctx\_new**(3)](/lc_ctx_new/3.md), [**lc\_ctx\_free**(3)](/lc_ctx_free/3.md), [**lc\_socket\_new**(3)](/lc_socket_new/3.md), **lc\_channel\_new**(3), [**lc\_channel\_ratelimit**(3)](/lc_channel_ratelimit/3.md)
