- MongoDB C Driver 1.9.3-dev »
- API Reference »
- mongoc_socket_t

# mongoc_socket_getnameinfo()

## 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()`.

Created using Sphinx 1.6.6, based on Sphinx Readable Theme.