### Function

# GLib get_host_name

since: 2.8

#### Declaration

    const gchar*
    g_get_host_name (
      void
    )

#### Description

Return a name for the machine.

The returned name is not necessarily a fully-qualified domain name, or even present in DNS or some other name service at all. It need not even be unique on your local network or site, but usually it is. Callers should not rely on the return value having any specific properties like uniqueness for security purposes. Even if the name of the machine is changed while an application is running, the return value from this function does not change. The returned string is owned by GLib and should not be modified or freed. If no name can be determined, a default fixed string “localhost” is returned.

The encoding of the returned string is UTF-8.

Available since: 2.8

#### Return value

Type: `const gchar*`

The host name of the machine.

The data is owned by the called function.
The value is a NUL terminated UTF-8 string.