---
name: "mongoc_socket_send"
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_send"
---

# mongoc\_socket\_send(3)

## SYNOPSIS

```
ssize_t
mongoc_socket_send (mongoc_socket_t *sock,
                    const void *buf,
                    size_t buflen,
                    int64_t expire_at);
```

## PARAMETERS

- •

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

- •

  **buf**: A buffer to send.

- •

  **buflen**: A size\_t with the number of bytes in buf.

- •

  **expire\_at**: A int64\_t with an absolute timeout for the operation or 0. The timeout is in monotonic time using microseconds. You can retrieve the current monotonic time with *System Clock*.

## DESCRIPTION

Sends buflen bytes in buf to the destination. If a timeout expired, the number of bytes sent will be returned or -1 if no bytes were sent.

## RETURNS

\-1 on failure and errno is set, or the number of bytes sent.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
