UnixSocketAddress

Support for UNIX-domain (also known as local) sockets, corresponding to struct sockaddr_un.

UNIX domain sockets are generally visible in the filesystem. However, some systems support abstract socket names which are not visible in the filesystem and not affected by the filesystem permissions, visibility, etc. Currently this is only supported under Linux. If you attempt to use abstract sockets on other systems, function calls may return gio.types.IOErrorEnum.NotSupported errors. You can use gio.unix_socket_address.UnixSocketAddress.abstractNamesSupported to see if abstract names are supported.

Since GLib 2.72, gio.unix_socket_address.UnixSocketAddress is available on all platforms. It requires underlying system support (such as Windows 10 with AF_UNIX) at run time.

Before GLib 2.72, <gio/gunixsocketaddress.h> belonged to the UNIX-specific GIO interfaces, thus you had to use the gio-unix-2.0.pc pkg-config file when using it. This is no longer necessary since GLib 2.72.

Constructors

this
this(string path)

Creates a new #GUnixSocketAddress for path.

Members

Functions

getAddressType
gio.types.UnixSocketAddressType getAddressType()

Gets address's type.

getIsAbstract
bool getIsAbstract()

Tests if address is abstract.

getPath
string getPath()

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

getPathLen
size_t getPathLen()

Gets the length of address's path.

Static functions

abstractNamesSupported
bool abstractNamesSupported()

Checks if abstract UNIX domain socket names are supported.

newAbstract
gio.unix_socket_address.UnixSocketAddress newAbstract(string path)

Creates a new gio.types.UnixSocketAddressType.AbstractPadded #GUnixSocketAddress for path.

newWithType
gio.unix_socket_address.UnixSocketAddress newWithType(string path, gio.types.UnixSocketAddressType type)

Creates a new #GUnixSocketAddress of type type with name path.

Inherited Members

From SocketAddress

newFromNative
gio.socket_address.SocketAddress newFromNative(void* native, size_t len)

Creates a #GSocketAddress subclass corresponding to the native struct sockaddr native.

getFamily
gio.types.SocketFamily getFamily()

Gets the socket family type of address.

getNativeSize
ptrdiff_t getNativeSize()

Gets the size of address's native struct sockaddr. You can use this to allocate memory to pass to gio.socket_address.SocketAddress.toNative.

toNative
bool toNative(void* dest, size_t destlen)

Converts a #GSocketAddress to a native struct sockaddr, which can be passed to low-level functions like connect() or bind().