Gio.InetAddress¶
class — extends GObject.Object
GInetAddress represents an IPv4 or IPv6 internet address. Use
Resolver.lookup_by_name or
Resolver.lookup_by_name_async to look up the GInetAddress for
a hostname. Use Resolver.lookup_by_address or
Resolver.lookup_by_address_async to look up the hostname for a
GInetAddress.
To actually connect to a remote host, you will need a
InetSocketAddress (which includes a GInetAddress as well as a
port number).
Constructors¶
new_any¶
Creates a InetAddress for the "any" address (unassigned/"don't
care") for family.
Parameters:
family— the address family
new_from_bytes¶
Creates a new InetAddress from the given family and bytes.
bytes should be 4 bytes for SocketFamily.IPV4 and 16 bytes for
SocketFamily.IPV6.
Parameters:
bytes— raw address datafamily— the address family ofbytes
new_from_bytes_with_ipv6_info¶
@classmethod
def new_from_bytes_with_ipv6_info(cls, bytes: list[int], family: SocketFamily | int, flowinfo: int, scope_id: int) -> InetAddress
Creates a new InetAddress from the given family, bytes
and scope_id.
bytes must be 4 bytes for SocketFamily.IPV4 and 16 bytes for
SocketFamily.IPV6.
Parameters:
bytes— raw address datafamily— the address family ofbytesscope_id— the scope-id of the address
new_from_string¶
Parses string as an IP address and creates a new 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.
Parameters:
string— a string representation of an IP address
new_loopback¶
Creates a InetAddress for the loopback address for family.
Parameters:
family— the address family
Methods¶
equal¶
Checks if two InetAddress instances are equal, e.g. the same address.
Parameters:
other_address— AnotherInetAddress.
get_family¶
Gets address's family
get_flowinfo¶
Gets the value of InetAddress.flowinfo.
get_is_any¶
Tests whether address is the "any" address for its family.
get_is_link_local¶
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).
get_is_loopback¶
Tests whether address is the loopback address for its family.
get_is_mc_global¶
Tests whether address is a global multicast address.
get_is_mc_link_local¶
Tests whether address is a link-local multicast address.
get_is_mc_node_local¶
Tests whether address is a node-local multicast address.
get_is_mc_org_local¶
Tests whether address is an organization-local multicast address.
get_is_mc_site_local¶
Tests whether address is a site-local multicast address.
get_is_multicast¶
Tests whether address is a multicast address.
get_is_site_local¶
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).
get_native_size¶
Gets the size of the native raw binary address for address. This
is the size of the data that you get from g_inet_address_to_bytes().
get_scope_id¶
Gets the value of InetAddress.scope-id.
to_string¶
Converts address to string form.
Virtual methods¶
do_to_string¶
Converts address to string form.
Properties¶
bytes¶
The raw address data.
family¶
The address family (IPv4 or IPv6).
flowinfo¶
The flowinfo for an IPv6 address.
See InetAddress.get_flowinfo.
is_any¶
Whether this is the "any" address for its family.
See InetAddress.get_is_any.
is_link_local¶
Whether this is a link-local address.
See InetAddress.get_is_link_local.
is_loopback¶
Whether this is the loopback address for its family.
See InetAddress.get_is_loopback.
is_mc_global¶
Whether this is a global multicast address.
See InetAddress.get_is_mc_global.
is_mc_link_local¶
Whether this is a link-local multicast address.
See InetAddress.get_is_mc_link_local.
is_mc_node_local¶
Whether this is a node-local multicast address.
See InetAddress.get_is_mc_node_local.
is_mc_org_local¶
Whether this is an organization-local multicast address.
See InetAddress.get_is_mc_org_local.
is_mc_site_local¶
Whether this is a site-local multicast address.
See InetAddress.get_is_mc_site_local.
is_multicast¶
Whether this is a multicast address.
See InetAddress.get_is_multicast.
is_site_local¶
Whether this is a site-local address.
See InetAddress.get_is_loopback.
scope_id¶
The scope-id for an IPv6 address.
See InetAddress.get_scope_id.