---
name: "mongoc_socket_recv"
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_recv"
---

# mongoc\_socket\_recv(3)

## SYNOPSIS

```
ssize_t
mongoc_socket_recv (mongoc_socket_t *sock,
                    void *buf,
                    size_t buflen,
                    int flags,
                    int64_t expire_at);
```

## PARAMETERS

- •

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

- •

  **buf**: A buffer to read into.

- •

  **buflen**: A size\_t with the number of bytes to receive.

- •

  **flags**: flags for **recv()**.

- •

  **expire\_at**: A int64\_t with the time to expire in monotonic time using *System Clock*, which is in microseconds.

## DESCRIPTION

This function performs a **recv()** on the underlying socket.

## RETURNS

The number of bytes received on success, 0 on stream closed, and -1 if there was a failure and errno is set.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
