---
name: "mongoc_socket_setsockopt"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_socket_setsockopt"
---

# mongoc\_socket\_setsockopt(3)

## SYNOPSIS

```
int
mongoc_socket_setsockopt (mongoc_socket_t *sock,
                          int level,
                          int optname,
                          const void *optval,
                          mongoc_socklen_t optlen);
```

## PARAMETERS

- •

  **sock**: A *mongoc\_socket\_t*.

- •

  **level**: A sockopt level.

- •

  **optname**: A sockopt name.

- •

  **optval**: A the value for the sockopt.

- •

  **optlen**: A mongoc\_socklen\_t that contains the length of optval.

## DESCRIPTION

This is a helper function for **setsockopt()**.

## RETURNS

0 on success, -1 on failure and errno is set.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
