---
name: "mongoc_socket_getnameinfo"
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_getnameinfo"
---

# mongoc\_socket\_getnameinfo(3)

## SYNOPSIS

```
char *
mongoc_socket_getnameinfo (mongoc_socket_t *sock);
```

## PARAMETERS

- •

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

## DESCRIPTION

This is a helper around getting the local name of a socket. It is a wrapper around **getpeername()** and **getnameinfo()**.

## RETURNS

A newly allocated string that should be freed with *bson\_free()*.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
