Gio.UnixSocketAddress¶
- Subclasses:
None
Methods¶
- Inherited:
Gio.SocketAddress (4), GObject.Object (37), Gio.SocketConnectable (3)
- Structs:
class |
|
class |
|
class |
|
class |
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
|
||
r/w/co |
|||
r/w/co |
|||
r/w/co |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gio.UnixSocketAddress(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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
G_IO_ERROR_NOT_SUPPORTED
errors. You can use [func`Gio`.UnixSocketAddress.abstract_names_supported] to see if abstract names are supported.Since GLib 2.72,
GUnixSocketAddress
is available on all platforms. It requires underlying system support (such as Windows 10 withAF_UNIX
) at run time.Before GLib 2.72,
<gio/gunixsocketaddress.h>
belonged to the UNIX-specific GIO interfaces, thus you had to use thegio-unix-2.0.pc
pkg-config file when using it. This is no longer necessary since GLib 2.72.- classmethod abstract_names_supported()[source]¶
-
Checks if abstract UNIX domain socket names are supported.
New in version 2.22.
- classmethod new(path)[source]¶
- Parameters:
path (
str
) – the socket path- Returns:
a new
Gio.UnixSocketAddress
- Return type:
Creates a new
Gio.UnixSocketAddress
for path.To create abstract socket addresses, on systems that support that, use
Gio.UnixSocketAddress.new_abstract
().New in version 2.22.
- classmethod new_abstract(path)[source]¶
- Parameters:
path ([
int
]) – the abstract name- Returns:
a new
Gio.UnixSocketAddress
- Return type:
Creates a new
Gio.UnixSocketAddressType.ABSTRACT_PADDED
Gio.UnixSocketAddress
for path.Deprecated since version ???: Use
Gio.UnixSocketAddress.new_with_type
().
- classmethod new_with_type(path, type)[source]¶
- Parameters:
path ([
int
]) – the nametype (
Gio.UnixSocketAddressType
) – aGio.UnixSocketAddressType
- Returns:
a new
Gio.UnixSocketAddress
- Return type:
Creates a new
Gio.UnixSocketAddress
of type type with name path.If type is
Gio.UnixSocketAddressType.PATH
, this is equivalent to callingGio.UnixSocketAddress.new
().If type is
Gio.UnixSocketAddressType.ANONYMOUS
, path and path_len will be ignored.If path_type is
Gio.UnixSocketAddressType.ABSTRACT
, then path_len bytes of path will be copied to the socket’s path, and only those bytes will be considered part of the name. (If path_len is -1, then path is assumed to be NUL-terminated.) For example, if path was “test”, then callingGio.SocketAddress.get_native_size
() on the returned socket would return 7 (2 bytes of overhead, 1 byte for the abstract-socket indicator byte, and 4 bytes for the name “test”).If path_type is
Gio.UnixSocketAddressType.ABSTRACT_PADDED
, then path_len bytes of path will be copied to the socket’s path, the rest of the path will be padded with 0 bytes, and the entire zero-padded buffer will be considered the name. (As above, if path_len is -1, then path is assumed to be NUL-terminated.) In this case,Gio.SocketAddress.get_native_size
() will always return the full size of astruct sockaddr_un
, althoughGio.UnixSocketAddress.get_path_len
() will still return just the length of path.Gio.UnixSocketAddressType.ABSTRACT
is preferred overGio.UnixSocketAddressType.ABSTRACT_PADDED
for new programs. Of course, when connecting to a server created by another process, you must use the appropriate type corresponding to how that process created its listening socket.New in version 2.26.
- get_is_abstract()[source]¶
-
Tests if self is abstract.
New in version 2.22.
Deprecated since version ???: Use
Gio.UnixSocketAddress.get_address_type
()
- get_path()[source]¶
- Returns:
the path for self
- Return type:
Gets self'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
Gio.UnixSocketAddress.get_path_len
() to get the true length of this string.New in version 2.22.
- get_path_len()[source]¶
- Returns:
the length of the path
- Return type:
Gets the length of self's path.
For details, see
Gio.UnixSocketAddress.get_path
().New in version 2.22.
Property Details¶
- Gio.UnixSocketAddress.props.abstract¶
- Name:
abstract
- Type:
- Default Value:
- Flags:
Whether or not this is an abstract address
Deprecated since version ???: Use
Gio.UnixSocketAddress
:address-type
, which distinguishes between zero-padded and non-zero-padded abstract addresses.
- Gio.UnixSocketAddress.props.address_type¶
- Name:
address-type
- Type:
- Default Value:
- Flags:
The type of Unix socket address.
New in version 2.22.
- Gio.UnixSocketAddress.props.path¶
- Name:
path
- Type:
- Default Value:
- Flags:
Unix socket path.
New in version 2.22.
- Gio.UnixSocketAddress.props.path_as_array¶
- Name:
path-as-array
- Type:
- Default Value:
- Flags:
Unix socket path, as a byte array.
New in version 2.22.