Gio.InetAddress - Classes - Gio 2.0 (original) (raw)

g GObject.Object GObject.Object Gio.InetAddress Gio.InetAddress GObject.Object->Gio.InetAddress

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class new_any (family)
class new_from_bytes (bytes, family)
class new_from_string (string)
class new_loopback (family)
equal (other_address)
get_family ()
get_is_any ()
get_is_link_local ()
get_is_loopback ()
get_is_mc_global ()
get_is_mc_link_local ()
get_is_mc_node_local ()
get_is_mc_org_local ()
get_is_mc_site_local ()
get_is_multicast ()
get_is_site_local ()
get_native_size ()
to_string ()

Virtual Methods

Inherited:

GObject.Object (7)

do_to_string ()

Properties

Name Type Flags Short Description
bytes int r/w/co
family Gio.SocketFamily r/w/co
is-any bool r
is-link-local bool r
is-loopback bool r
is-mc-global bool r
is-mc-link-local bool r
is-mc-node-local bool r
is-mc-org-local bool r
is-mc-site-local bool r
is-multicast bool r
is-site-local bool r

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name Type Access Description
parent_instance GObject.Object r

Class Details

class Gio.InetAddress(**kwargs)

Bases:

GObject.Object

Abstract:

No

Structure:

Gio.InetAddressClass

GInetAddress represents an IPv4 or IPv6 internet address. Use [method`Gio`.Resolver.lookup_by_name] or [method`Gio`.Resolver.lookup_by_name_async] to look up the GInetAddress for a hostname. Use [method`Gio`.Resolver.lookup_by_address] or [method`Gio`.Resolver.lookup_by_address_async] to look up the hostname for aGInetAddress.

To actually connect to a remote host, you will need a [class`Gio`.InetSocketAddress] (which includes a GInetAddress as well as a port number).

classmethod new_any(family)[source]

Parameters:

family (Gio.SocketFamily) – the address family

Returns:

a new Gio.InetAddress corresponding to the “any” address for family. Free the returned object with GObject.Object.unref().

Return type:

Gio.InetAddress

Creates a Gio.InetAddress for the “any” address (unassigned/”don’t care”) for family.

New in version 2.22.

classmethod new_from_bytes(bytes, family)[source]

Parameters:

Returns:

a new Gio.InetAddress corresponding to family and bytes. Free the returned object with GObject.Object.unref().

Return type:

Gio.InetAddress

Creates a new Gio.InetAddress from the given family and bytes.bytes should be 4 bytes for Gio.SocketFamily.IPV4 and 16 bytes forGio.SocketFamily.IPV6.

New in version 2.22.

classmethod new_from_string(string)[source]

Parameters:

string (str) – a string representation of an IP address

Returns:

a new Gio.InetAddress corresponding to string, or None if string could not be parsed. Free the returned object with GObject.Object.unref().

Return type:

Gio.InetAddress or None

Parses string as an IP address and creates a new Gio.InetAddress.

New in version 2.22.

classmethod new_loopback(family)[source]

Parameters:

family (Gio.SocketFamily) – the address family

Returns:

a new Gio.InetAddress corresponding to the loopback address for family. Free the returned object with GObject.Object.unref().

Return type:

Gio.InetAddress

Creates a Gio.InetAddress for the loopback address for family.

New in version 2.22.

equal(other_address)[source]

Parameters:

other_address (Gio.InetAddress) – Another Gio.InetAddress.

Returns:

True if self and other_address are equal, False otherwise.

Return type:

bool

Checks if two Gio.InetAddress instances are equal, e.g. the same address.

New in version 2.30.

get_family()[source]

Returns:

self's family

Return type:

Gio.SocketFamily

Gets self's family

New in version 2.22.

get_is_any()[source]

Returns:

True if self is the “any” address for its family.

Return type:

bool

Tests whether self is the “any” address for its family.

New in version 2.22.

get_is_link_local()[source]

Returns:

True if self is a link-local address.

Return type:

bool

Tests whether self is a link-local address (that is, if it identifies a host on a local network that is not connected to the Internet).

New in version 2.22.

get_is_loopback()[source]

Returns:

True if self is the loopback address for its family.

Return type:

bool

Tests whether self is the loopback address for its family.

New in version 2.22.

get_is_mc_global()[source]

Returns:

True if self is a global multicast address.

Return type:

bool

Tests whether self is a global multicast address.

New in version 2.22.

get_is_mc_link_local()[source]

Returns:

True if self is a link-local multicast address.

Return type:

bool

Tests whether self is a link-local multicast address.

New in version 2.22.

get_is_mc_node_local()[source]

Returns:

True if self is a node-local multicast address.

Return type:

bool

Tests whether self is a node-local multicast address.

New in version 2.22.

get_is_mc_org_local()[source]

Returns:

True if self is an organization-local multicast address.

Return type:

bool

Tests whether self is an organization-local multicast address.

New in version 2.22.

get_is_mc_site_local()[source]

Returns:

True if self is a site-local multicast address.

Return type:

bool

Tests whether self is a site-local multicast address.

New in version 2.22.

get_is_multicast()[source]

Returns:

True if self is a multicast address.

Return type:

bool

Tests whether self is a multicast address.

New in version 2.22.

get_is_site_local()[source]

Returns:

True if self is a site-local address.

Return type:

bool

Tests whether self 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).

New in version 2.22.

get_native_size()[source]

Returns:

the number of bytes used for the native version of self.

Return type:

int

Gets the size of the native raw binary address for self. This is the size of the data that you get from g_inet_address_to_bytes().

New in version 2.22.

to_string()[source]

Returns:

a representation of self as a string, which should be freed after use.

Return type:

str

Converts self to string form.

New in version 2.22.

do_to_string() virtual

Returns:

a representation of address as a string, which should be freed after use.

Return type:

str

Converts address to string form.

New in version 2.22.

Property Details

Gio.InetAddress.props.bytes

Name:

bytes

Type:

int

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The raw address data.

New in version 2.22.

Gio.InetAddress.props.family

Name:

family

Type:

Gio.SocketFamily

Default Value:

Gio.SocketFamily.INVALID

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The address family (IPv4 or IPv6).

New in version 2.22.

Gio.InetAddress.props.is_any

Name:

is-any

Type:

bool

Default Value:

False

Flags:

READABLE

Whether this is the “any” address for its family. See Gio.InetAddress.get_is_any().

New in version 2.22.

Gio.InetAddress.props.is_link_local

Name:

is-link-local

Type:

bool

Default Value:

False

Flags:

READABLE

Whether this is a link-local address. See Gio.InetAddress.get_is_link_local().

New in version 2.22.

Gio.InetAddress.props.is_loopback

Name:

is-loopback

Type:

bool

Default Value:

False

Flags:

READABLE

Whether this is the loopback address for its family. See Gio.InetAddress.get_is_loopback().

New in version 2.22.

Gio.InetAddress.props.is_mc_global

Name:

is-mc-global

Type:

bool

Default Value:

False

Flags:

READABLE

Whether this is a global multicast address. See Gio.InetAddress.get_is_mc_global().

New in version 2.22.

Gio.InetAddress.props.is_mc_link_local

Name:

is-mc-link-local

Type:

bool

Default Value:

False

Flags:

READABLE

Whether this is a link-local multicast address. See Gio.InetAddress.get_is_mc_link_local().

New in version 2.22.

Gio.InetAddress.props.is_mc_node_local

Name:

is-mc-node-local

Type:

bool

Default Value:

False

Flags:

READABLE

Whether this is a node-local multicast address. See Gio.InetAddress.get_is_mc_node_local().

New in version 2.22.

Gio.InetAddress.props.is_mc_org_local

Name:

is-mc-org-local

Type:

bool

Default Value:

False

Flags:

READABLE

Whether this is an organization-local multicast address. See Gio.InetAddress.get_is_mc_org_local().

New in version 2.22.

Gio.InetAddress.props.is_mc_site_local

Name:

is-mc-site-local

Type:

bool

Default Value:

False

Flags:

READABLE

Whether this is a site-local multicast address. See Gio.InetAddress.get_is_mc_site_local().

New in version 2.22.

Gio.InetAddress.props.is_multicast

Name:

is-multicast

Type:

bool

Default Value:

False

Flags:

READABLE

Whether this is a multicast address. See Gio.InetAddress.get_is_multicast().

New in version 2.22.

Gio.InetAddress.props.is_site_local

Name:

is-site-local

Type:

bool

Default Value:

False

Flags:

READABLE

Whether this is a site-local address. See Gio.InetAddress.get_is_loopback().

New in version 2.22.