: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_string(string: str) -> ~gi.repository.Gio.InetAddress | None Parses ``string`` as an IP address and creates a new :obj:`~gi.repository.Gio.InetAddress`\. .. 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_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:: 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 type of the None singleton. .. versionadded:: 2.22 .. attribute:: props.family :type: ~gi.repository.Gio.SocketFamily The type of the None singleton. .. versionadded:: 2.22 .. attribute:: props.is_any :type: bool The type of the None singleton. .. versionadded:: 2.22 .. attribute:: props.is_link_local :type: bool The type of the None singleton. .. versionadded:: 2.22 .. attribute:: props.is_loopback :type: bool The type of the None singleton. .. versionadded:: 2.22 .. attribute:: props.is_mc_global :type: bool The type of the None singleton. .. versionadded:: 2.22 .. attribute:: props.is_mc_link_local :type: bool The type of the None singleton. .. versionadded:: 2.22 .. attribute:: props.is_mc_node_local :type: bool The type of the None singleton. .. versionadded:: 2.22 .. attribute:: props.is_mc_org_local :type: bool The type of the None singleton. .. versionadded:: 2.22 .. attribute:: props.is_mc_site_local :type: bool The type of the None singleton. .. versionadded:: 2.22 .. attribute:: props.is_multicast :type: bool The type of the None singleton. .. versionadded:: 2.22 .. attribute:: props.is_site_local :type: bool The type of the None singleton. .. versionadded:: 2.22 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