- MongoDB C Driver 1.13.1 »
- API Reference »
- mongoc_socket_t

# mongoc_socket_setsockopt()

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

Created using Sphinx 1.8.3, based on Sphinx Readable Theme.