---
name: "mongoc_socket_close"
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_close"
---

# mongoc\_socket\_close(3)

## SYNOPSIS

```
int
mongoc_socket_close (mongoc_socket_t *socket);
```

## PARAMETERS

- •

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

## DESCRIPTION

This function is a wrapper around the BSD socket **shutdown()** and **close()** functions, and their Windows equivalents. The socket is shut down only if the current process is the same as the process that opened the socket. Regardless, the socket is then closed.

## RETURNS

0 on success, -1 on failure to close the socket. On failure, the socket's errno is set; retrieve it with *mongoc\_socket\_errno()*.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
