:right-sidebar: True InetAddress =================================================================== .. currentmodule:: gi.repository.Gio .. class:: InetAddress(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` ``GInetAddress`` represents an IPv4 or IPv6 internet address. Use :obj:`~gi.repository.Gio.Resolver.lookup_by_name` or :obj:`~gi.repository.Gio.Resolver.lookup_by_name_async` to look up the ``GInetAddress`` for a hostname. Use :obj:`~gi.repository.Gio.Resolver.lookup_by_address` or :obj:`~gi.repository.Gio.Resolver.lookup_by_address_async` to look up the hostname for a ``GInetAddress``\. To actually connect to a remote host, you will need a :obj:`~gi.repository.Gio.InetSocketAddress` (which includes a ``GInetAddress`` as well as a port number). Constructors ------------ .. rst-class:: interim-class .. class:: InetAddress :no-index: .. classmethod:: new_any(family: ~gi.repository.Gio.SocketFamily) -> ~gi.repository.Gio.InetAddress Creates a :obj:`~gi.repository.Gio.InetAddress` for the "any" address (unassigned/"don't care") for ``family``\. .. versionadded:: 2.22 :param family: the address family .. classmethod:: new_from_bytes(bytes: list[int], family: ~gi.repository.Gio.SocketFamily) -> ~gi.repository.Gio.InetAddress Creates a new :obj:`~gi.repository.Gio.InetAddress` from the given ``family`` and ``bytes``\. ``bytes`` should be 4 bytes for :const:`~gi.repository.Gio.SocketFamily.IPV4` and 16 bytes for :const:`~gi.repository.Gio.SocketFamily.IPV6`. .. versionadded:: 2.22 :param bytes: raw address data :param family: the address family of ``bytes`` .. classmethod:: new_from_bytes_with_ipv6_info(bytes: list[int], family: ~gi.repository.Gio.SocketFamily, flowinfo: int, scope_id: int) -> ~gi.repository.Gio.InetAddress Creates a new :obj:`~gi.repository.Gio.InetAddress` from the given ``family``\, ``bytes`` and ``scope_id``\. ``bytes`` must be 4 bytes for :obj:`~gi.repository.Gio.SocketFamily.IPV4` and 16 bytes for :obj:`~gi.repository.Gio.SocketFamily.IPV6`\. .. versionadded:: 2.86 :param bytes: raw address data :param family: the address family of ``bytes`` :param flowinfo: :param scope_id: the scope-id of the address .. classmethod:: new_from_string(string: str) -> ~gi.repository.Gio.InetAddress | None Parses ``string`` as an IP address and creates a new :obj:`~gi.repository.Gio.InetAddress`\. If ``address`` is an IPv6 address, it can also contain a scope ID (separated from the address by a ``%``\). Note that currently this behavior is platform specific. This may change in a future release. .. versionadded:: 2.22 :param string: a string representation of an IP address .. classmethod:: new_loopback(family: ~gi.repository.Gio.SocketFamily) -> ~gi.repository.Gio.InetAddress Creates a :obj:`~gi.repository.Gio.InetAddress` for the loopback address for ``family``\. .. versionadded:: 2.22 :param family: the address family Methods ------- .. rst-class:: interim-class .. class:: InetAddress :no-index: .. method:: do_to_string(self) -> str .. method:: equal(other_address: ~gi.repository.Gio.InetAddress) -> bool Checks if two :obj:`~gi.repository.Gio.InetAddress` instances are equal, e.g. the same address. .. versionadded:: 2.30 :param other_address: Another :obj:`~gi.repository.Gio.InetAddress`\. .. method:: get_family() -> ~gi.repository.Gio.SocketFamily Gets ``address``\'s family .. versionadded:: 2.22 .. method:: get_flowinfo() -> int Gets the value of :obj:`~gi.repository.Gio.InetAddress.props.flowinfo`\. .. versionadded:: 2.86 .. method:: get_is_any() -> bool Tests whether ``address`` is the "any" address for its family. .. versionadded:: 2.22 .. method:: get_is_link_local() -> bool Tests whether ``address`` is a link-local address (that is, if it identifies a host on a local network that is not connected to the Internet). .. versionadded:: 2.22 .. method:: get_is_loopback() -> bool Tests whether ``address`` is the loopback address for its family. .. versionadded:: 2.22 .. method:: get_is_mc_global() -> bool Tests whether ``address`` is a global multicast address. .. versionadded:: 2.22 .. method:: get_is_mc_link_local() -> bool Tests whether ``address`` is a link-local multicast address. .. versionadded:: 2.22 .. method:: get_is_mc_node_local() -> bool Tests whether ``address`` is a node-local multicast address. .. versionadded:: 2.22 .. method:: get_is_mc_org_local() -> bool Tests whether ``address`` is an organization-local multicast address. .. versionadded:: 2.22 .. method:: get_is_mc_site_local() -> bool Tests whether ``address`` is a site-local multicast address. .. versionadded:: 2.22 .. method:: get_is_multicast() -> bool Tests whether ``address`` is a multicast address. .. versionadded:: 2.22 .. method:: get_is_site_local() -> bool Tests whether ``address`` is a site-local address such as 10.0.0.1 (that is, the address identifies a host on a local network that can not be reached directly from the Internet, but which may have outgoing Internet connectivity via a NAT or firewall). .. versionadded:: 2.22 .. method:: get_native_size() -> int Gets the size of the native raw binary address for ``address``\. This is the size of the data that you get from :func:`~gi.repository.Gio.InetAddress.to_bytes`. .. versionadded:: 2.22 .. method:: get_scope_id() -> int Gets the value of :obj:`~gi.repository.Gio.InetAddress.props.scope_id`\. .. versionadded:: 2.86 .. method:: to_string() -> str Converts ``address`` to string form. .. versionadded:: 2.22 Properties ---------- .. rst-class:: interim-class .. class:: InetAddress :no-index: .. attribute:: props.bytes :type: ~typing.Any The raw address data. .. versionadded:: 2.22 .. attribute:: props.family :type: ~gi.repository.Gio.SocketFamily The address family (IPv4 or IPv6). .. versionadded:: 2.22 .. attribute:: props.flowinfo :type: int The flowinfo for an IPv6 address. See :obj:`~gi.repository.Gio.InetAddress.get_flowinfo`\. .. versionadded:: 2.86 .. attribute:: props.is_any :type: bool Whether this is the "any" address for its family. See :func:`~gi.repository.Gio.InetAddress.get_is_any`. .. versionadded:: 2.22 .. attribute:: props.is_link_local :type: bool Whether this is a link-local address. See :func:`~gi.repository.Gio.InetAddress.get_is_link_local`. .. versionadded:: 2.22 .. attribute:: props.is_loopback :type: bool Whether this is the loopback address for its family. See :func:`~gi.repository.Gio.InetAddress.get_is_loopback`. .. versionadded:: 2.22 .. attribute:: props.is_mc_global :type: bool Whether this is a global multicast address. See :func:`~gi.repository.Gio.InetAddress.get_is_mc_global`. .. versionadded:: 2.22 .. attribute:: props.is_mc_link_local :type: bool Whether this is a link-local multicast address. See :func:`~gi.repository.Gio.InetAddress.get_is_mc_link_local`. .. versionadded:: 2.22 .. attribute:: props.is_mc_node_local :type: bool Whether this is a node-local multicast address. See :func:`~gi.repository.Gio.InetAddress.get_is_mc_node_local`. .. versionadded:: 2.22 .. attribute:: props.is_mc_org_local :type: bool Whether this is an organization-local multicast address. See :func:`~gi.repository.Gio.InetAddress.get_is_mc_org_local`. .. versionadded:: 2.22 .. attribute:: props.is_mc_site_local :type: bool Whether this is a site-local multicast address. See :func:`~gi.repository.Gio.InetAddress.get_is_mc_site_local`. .. versionadded:: 2.22 .. attribute:: props.is_multicast :type: bool Whether this is a multicast address. See :func:`~gi.repository.Gio.InetAddress.get_is_multicast`. .. versionadded:: 2.22 .. attribute:: props.is_site_local :type: bool Whether this is a site-local address. See :func:`~gi.repository.Gio.InetAddress.get_is_loopback`. .. versionadded:: 2.22 .. attribute:: props.scope_id :type: int The scope-id for an IPv6 address. See :obj:`~gi.repository.Gio.InetAddress.get_scope_id`\. .. versionadded:: 2.86 Virtual Methods --------------- .. rst-class:: interim-class .. class:: InetAddress :no-index: .. method:: do_to_string() -> str Converts ``address`` to string form. .. versionadded:: 2.22 Fields ------ .. rst-class:: interim-class .. class:: InetAddress :no-index: .. attribute:: parent_instance .. attribute:: priv