Gio.UnixSocketAddress¶
| Subclasses: | None |
|---|
Methods¶
| Inherited: | Gio.SocketAddress (4), GObject.Object (37), Gio.SocketConnectable (3) |
|---|---|
| Structs: | GObject.ObjectClass (5) |
| class | abstract_names_supported () |
| class | new (path) |
| class | new_abstract (path) |
| class | new_with_type (path, type) |
get_address_type () |
|
get_is_abstract () |
|
get_path () |
|
get_path_len () |
Virtual Methods¶
| Inherited: | Gio.SocketAddress (3), GObject.Object (7), Gio.SocketConnectable (3) |
|---|
Properties¶
| Inherited: | Gio.SocketAddress (1) |
|---|
| Name | Type | Flags | Short Description |
|---|---|---|---|
abstract |
bool |
r/w/co | Whether or not this is an abstract address deprecated |
address-type |
Gio.UnixSocketAddressType |
r/w/co | The type of UNIX socket address |
path |
str |
r/w/co | UNIX socket path |
path-as-array |
GLib.ByteArray |
r/w/co | UNIX socket path, as byte array |
Signals¶
| Inherited: | GObject.Object (1) |
|---|
Fields¶
| Inherited: | GObject.Object (1) |
|---|
| Name | Type | Access | Description |
|---|---|---|---|
| parent_instance | Gio.SocketAddress |
r |
Class Details¶
-
class
Gio.UnixSocketAddress(**kwargs)¶ Bases: Gio.SocketAddressAbstract: No Structure: Gio.UnixSocketAddressClassSupport for UNIX-domain (also known as local) sockets.
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.IOErrorEnum.NOT_SUPPORTEDerrors. You can useGio.UnixSocketAddress.abstract_names_supported() to see if abstract names are supported.Note that
<gio/gunixsocketaddress.h>belongs to the UNIX-specific GIO interfaces, thus you have to use thegio-unix-2.0.pcpkg-config file when using it.-
classmethod
abstract_names_supported()[source]¶ Returns: Trueif supported,FalseotherwiseReturn type: boolChecks if abstract UNIX domain socket names are supported.
New in version 2.22.
-
classmethod
new(path)[source]¶ Parameters: path ( str) – the socket pathReturns: a new Gio.UnixSocketAddressReturn type: Gio.SocketAddressCreates a new
Gio.UnixSocketAddressfor 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 nameReturns: a new Gio.UnixSocketAddressReturn type: Gio.SocketAddressCreates a new
Gio.UnixSocketAddressType.ABSTRACT_PADDEDGio.UnixSocketAddressfor path.Deprecated since version ???: Use
Gio.UnixSocketAddress.new_with_type().
-
classmethod
new_with_type(path, type)[source]¶ Parameters: - path ([
int]) – the name - type (
Gio.UnixSocketAddressType) – aGio.UnixSocketAddressType
Returns: a new
Gio.UnixSocketAddressReturn type: Creates a new
Gio.UnixSocketAddressof 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.ABSTRACTis preferred overGio.UnixSocketAddressType.ABSTRACT_PADDEDfor 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.
- path ([
-
get_address_type()[source]¶ Returns: a Gio.UnixSocketAddressTypeReturn type: Gio.UnixSocketAddressTypeGets self’s type.
New in version 2.26.
-
get_is_abstract()[source]¶ Returns: Trueif the address is abstract,FalseotherwiseReturn type: boolTests 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: strGets 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: intGets the length of self’s path.
For details, see
Gio.UnixSocketAddress.get_path().New in version 2.22.
-
classmethod
Property Details¶
-
Gio.UnixSocketAddress.props.abstract¶ Name: abstractType: boolDefault Value: FalseFlags: READABLE,WRITABLE,CONSTRUCT_ONLYWhether 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-typeType: Gio.UnixSocketAddressTypeDefault Value: Gio.UnixSocketAddressType.PATHFlags: READABLE,WRITABLE,CONSTRUCT_ONLYThe type of UNIX socket address
-
Gio.UnixSocketAddress.props.path¶ Name: pathType: strDefault Value: NoneFlags: READABLE,WRITABLE,CONSTRUCT_ONLYUNIX socket path
-
Gio.UnixSocketAddress.props.path_as_array¶ Name: path-as-arrayType: GLib.ByteArrayDefault Value: NoneFlags: READABLE,WRITABLE,CONSTRUCT_ONLYUNIX socket path, as byte array