:right-sidebar: True SocketAddress =================================================================== .. currentmodule:: gi.repository.Gio .. class:: SocketAddress(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Subclasses: :class:`~gi.repository.Gio.InetSocketAddress`, :class:`~gi.repository.Gio.NativeSocketAddress`, :class:`~gi.repository.Gio.UnixSocketAddress` Implemented Interfaces: :class:`~gi.repository.Gio.SocketConnectable` ``GSocketAddress`` is the equivalent of ```struct sockaddr`` `__ and its subtypes in the BSD sockets API. This is an abstract class; use :obj:`~gi.repository.Gio.InetSocketAddress` for internet sockets, or :obj:`~gi.repository.Gio.UnixSocketAddress` for UNIX domain sockets. Constructors ------------ .. rst-class:: interim-class .. class:: SocketAddress :no-index: .. classmethod:: new_from_native(native: ~typing.Any, len: int) -> ~gi.repository.Gio.SocketAddress Creates a :obj:`~gi.repository.Gio.SocketAddress` subclass corresponding to the native struct sockaddr ``native``\. .. versionadded:: 2.22 :param native: a pointer to a struct sockaddr :param len: the size of the memory location pointed to by ``native`` Methods ------- .. rst-class:: interim-class .. class:: SocketAddress :no-index: .. method:: do_get_family(self) -> ~gi.repository.Gio.SocketFamily .. method:: do_get_native_size(self) -> int .. method:: do_to_native(self, dest: ~typing.Any, destlen: int) -> bool :param dest: :param destlen: .. method:: get_family() -> ~gi.repository.Gio.SocketFamily Gets the socket family type of ``address``\. .. versionadded:: 2.22 .. method:: get_native_size() -> int Gets the size of ``address``\'s native struct sockaddr. You can use this to allocate memory to pass to :func:`~gi.repository.Gio.SocketAddress.to_native`. .. versionadded:: 2.22 .. method:: to_native(dest: ~typing.Any, destlen: int) -> bool Converts a :obj:`~gi.repository.Gio.SocketAddress` to a native struct sockaddr, which can be passed to low-level functions like connect() or bind(). If not enough space is available, a :const:`~gi.repository.Gio.IOErrorEnum.NO_SPACE` error is returned. If the address type is not known on the system then a :const:`~gi.repository.Gio.IOErrorEnum.NOT_SUPPORTED` error is returned. .. versionadded:: 2.22 :param dest: a pointer to a memory location that will contain the native struct sockaddr :param destlen: the size of ``dest``\. Must be at least as large as :func:`~gi.repository.Gio.SocketAddress.get_native_size` Properties ---------- .. rst-class:: interim-class .. class:: SocketAddress :no-index: .. attribute:: props.family :type: ~gi.repository.Gio.SocketFamily The type of the None singleton. .. versionadded:: 2.22 Virtual Methods --------------- .. rst-class:: interim-class .. class:: SocketAddress :no-index: .. method:: do_get_family() -> ~gi.repository.Gio.SocketFamily Gets the socket family type of ``address``\. .. versionadded:: 2.22 .. method:: do_get_native_size() -> int Gets the size of ``address``\'s native struct sockaddr. You can use this to allocate memory to pass to :func:`~gi.repository.Gio.SocketAddress.to_native`. .. versionadded:: 2.22 .. method:: do_to_native(dest: ~typing.Any, destlen: int) -> bool Converts a :obj:`~gi.repository.Gio.SocketAddress` to a native struct sockaddr, which can be passed to low-level functions like connect() or bind(). If not enough space is available, a :const:`~gi.repository.Gio.IOErrorEnum.NO_SPACE` error is returned. If the address type is not known on the system then a :const:`~gi.repository.Gio.IOErrorEnum.NOT_SUPPORTED` error is returned. .. versionadded:: 2.22 :param dest: a pointer to a memory location that will contain the native struct sockaddr :param destlen: the size of ``dest``\. Must be at least as large as :func:`~gi.repository.Gio.SocketAddress.get_native_size` Fields ------ .. rst-class:: interim-class .. class:: SocketAddress :no-index: .. attribute:: parent_instance