## GUnixSocketAddress GUnixSocketAddress — UNIX GSocketAddress |

## Synopsis

                        GUnixSocketAddress;
    GSocketAddress *    g_unix_socket_address_new           (const gchar *path);
    GSocketAddress *    g_unix_socket_address_new_abstract  (const gchar *path,
                                                             int path_len);
    gboolean            g_unix_socket_address_get_is_abstract
                                                            (GUnixSocketAddress *address);
    const char *        g_unix_socket_address_get_path      (GUnixSocketAddress *address);
    gsize               g_unix_socket_address_get_path_len  (GUnixSocketAddress *address);
    gboolean            g_unix_socket_address_abstract_names_supported
                                                            (void);

## Object Hierarchy

      GObject
       +----GSocketAddress
             +----GUnixSocketAddress

## Implemented Interfaces

GUnixSocketAddress implements GSocketConnectable.

## Properties

      "abstract"                 gboolean              : Read / Write / Construct Only
      "path"                     gchar*                : Read / Write / Construct Only
      "path-as-array"            GByteArray*           : Read / Write / Construct Only

## Description

Support for UNIX-domain (aka local) sockets.

## Details

### GUnixSocketAddress

    typedef struct _GUnixSocketAddress GUnixSocketAddress;

A UNIX-domain (local) socket address, corresponding to a struct sockaddr_un.

### g_unix_socket_address_new ()

    GSocketAddress *    g_unix_socket_address_new           (const gchar *path);

Creates a new GUnixSocketAddress for `path`.

To create abstract socket addresses, on systems that support that, use `g_unix_socket_address_new_abstract()`.

`path` : | the socket path
Returns : | a new GUnixSocketAddress

Since 2.22

### g_unix_socket_address_new_abstract ()

    GSocketAddress *    g_unix_socket_address_new_abstract  (const gchar *path,
                                                             int path_len);

Creates a new abstract GUnixSocketAddress for `path`.

Unix domain sockets are generally visible in the filesystem. However, some systems support abstract socket name which are not visible in the filesystem and not affected by the filesystem permissions, visibility, etc.

Note that not all systems (really only Linux) support abstract socket names, so if you use them on other systems function calls may return `G_IO_ERROR_NOT_SUPPORTED` errors. You can use `g_unix_socket_address_abstract_names_supported()` to see if abstract names are supported.

If `path_len` is -1 then `path` is assumed to be a zero terminated string (although in general abstract names need not be zero terminated and can have embedded nuls). All bytes after `path_len` up to the max size of an abstract unix domain name is filled with zero bytes.

`path` : | the abstract name
`path_len` : | the length of `path`, or -1
Returns : | a new GUnixSocketAddress

Since 2.22

### g_unix_socket_address_get_is_abstract ()

    gboolean            g_unix_socket_address_get_is_abstract
                                                            (GUnixSocketAddress *address);

Gets `address`'s path.

`address` : | a GInetSocketAddress
Returns : | `TRUE` if the address is abstract, `FALSE` otherwise

Since 2.22

### g_unix_socket_address_get_path ()

    const char *        g_unix_socket_address_get_path      (GUnixSocketAddress *address);

Gets `address`'s path, or for abstract sockets the "name".

Guaranteed to be zero-terminated, but an abstract socket may contain embedded zeros, and thus you should use `g_unix_socket_address_get_path_len()` to get the true length of this string.

`address` : | a GInetSocketAddress
Returns : | the path for `address`

Since 2.22

### g_unix_socket_address_get_path_len ()

    gsize               g_unix_socket_address_get_path_len  (GUnixSocketAddress *address);

Gets the length of `address`'s path.

For details, see `g_unix_socket_address_get_path()`.

`address` : | a GInetSocketAddress
Returns : | the length of the path

Since 2.22

### g_unix_socket_address_abstract_names_supported ()

    gboolean            g_unix_socket_address_abstract_names_supported
                                                            (void);

Checks if abstract unix domain socket names are supported.

Returns : | `TRUE` if supported, `FALSE` otherwise

Since 2.22

## Property Details

### The `"abstract"` property

      "abstract"                 gboolean              : Read / Write / Construct Only

Whether or not this is an abstract address.

Default value: FALSE

### The `"path"` property

      "path"                     gchar*                : Read / Write / Construct Only

UNIX socket path.

Default value: NULL

### The `"path-as-array"` property

      "path-as-array"            GByteArray*           : Read / Write / Construct Only

UNIX socket path, as byte array.