1.45 <GInetAddress>

Class: <GInetAddress>

It derives from <GObject>.

<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 <GInetSocketAddress> (which includes a <GInetAddress> as well as a port number).

Fields

parent-instance

Properties

Property: inet-address:bytes self

The raw address data.

Its value is a foreign pointer (or, to set it, a bytevector).

It can only be set when the object is made, with #:bytes.

Property: inet-address:family self

The address family (IPv4 or IPv6).

Its value is a <GSocketFamily> (or, to set it, one of its symbols).

It can only be set when the object is made, with #:family.

Property: inet-address:flowinfo self

The flowinfo for an IPv6 address. See inet-address:get-flowinfo.

Its value is an unsigned 32-bit integer.

It can only be set when the object is made, with #:flowinfo.

Property: inet-address:is-any self

Whether this is the "any" address for its family. See inet-address:get-is-any?.

Its value is a boolean.

It is read only.

Whether this is a link-local address. See inet-address:get-is-link-local?.

Its value is a boolean.

It is read only.

Property: inet-address:is-loopback self

Whether this is the loopback address for its family. See inet-address:get-is-loopback?.

Its value is a boolean.

It is read only.

Property: inet-address:is-mc-global self

Whether this is a global multicast address. See inet-address:get-is-mc-global?.

Its value is a boolean.

It is read only.

Whether this is a link-local multicast address. See inet-address:get-is-mc-link-local?.

Its value is a boolean.

It is read only.

Property: inet-address:is-mc-node-local self

Whether this is a node-local multicast address. See inet-address:get-is-mc-node-local?.

Its value is a boolean.

It is read only.

Property: inet-address:is-mc-org-local self

Whether this is an organization-local multicast address. See inet-address:get-is-mc-org-local?.

Its value is a boolean.

It is read only.

Property: inet-address:is-mc-site-local self

Whether this is a site-local multicast address. See inet-address:get-is-mc-site-local?.

Its value is a boolean.

It is read only.

Property: inet-address:is-multicast self

Whether this is a multicast address. See inet-address:get-is-multicast?.

Its value is a boolean.

It is read only.

Property: inet-address:is-site-local self

Whether this is a site-local address. See inet-address:get-is-loopback?.

Its value is a boolean.

It is read only.

Property: inet-address:scope-id self

The scope-id for an IPv6 address. See inet-address:get-scope-id.

Its value is an unsigned 32-bit integer.

It can only be set when the object is made, with #:scope-id.

Procedures

Method: inet-address:equal? self other-address ⇒ %return
Method: equal? self other-address ⇒ %return

Checks if two <GInetAddress> instances are equal, e.g. the same address.

self

Passed: a <GInetAddress>.

A <GInetAddress>.

other-address

Passed: a <GInetAddress>.

Another <GInetAddress>.

%return

Returned: a boolean.

#t if self and other-address are equal, #f otherwise.

Method: inet-address:get-family self ⇒ %return
Method: get-family self ⇒ %return

Gets self’s family

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a <GSocketFamily>.

self’s family

Method: inet-address:get-flowinfo self ⇒ %return
Method: get-flowinfo self ⇒ %return

Gets the value of inet-address:flowinfo.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: an unsigned 32-bit integer.

The flowinfo for the address, 0 if unset or not IPv6 address.

Method: inet-address:get-is-any? self ⇒ %return
Method: get-is-any? self ⇒ %return

Tests whether self is the "any" address for its family.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a boolean.

#t if self is the "any" address for its family.

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).

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a boolean.

#t if self is a link-local address.

Method: inet-address:get-is-loopback? self ⇒ %return
Method: get-is-loopback? self ⇒ %return

Tests whether self is the loopback address for its family.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a boolean.

#t if self is the loopback address for its family.

Method: inet-address:get-is-mc-global? self ⇒ %return
Method: get-is-mc-global? self ⇒ %return

Tests whether self is a global multicast address.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a boolean.

#t if self is a global multicast address.

Tests whether self is a link-local multicast address.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a boolean.

#t if self is a link-local multicast address.

Method: inet-address:get-is-mc-node-local? self ⇒ %return
Method: get-is-mc-node-local? self ⇒ %return

Tests whether self is a node-local multicast address.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a boolean.

#t if self is a node-local multicast address.

Method: inet-address:get-is-mc-org-local? self ⇒ %return
Method: get-is-mc-org-local? self ⇒ %return

Tests whether self is an organization-local multicast address.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a boolean.

#t if self is an organization-local multicast address.

Method: inet-address:get-is-mc-site-local? self ⇒ %return
Method: get-is-mc-site-local? self ⇒ %return

Tests whether self is a site-local multicast address.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a boolean.

#t if self is a site-local multicast address.

Method: inet-address:get-is-multicast? self ⇒ %return
Method: get-is-multicast? self ⇒ %return

Tests whether self is a multicast address.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a boolean.

#t if self is a multicast address.

Method: inet-address:get-is-site-local? self ⇒ %return
Method: get-is-site-local? self ⇒ %return

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).

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a boolean.

#t if self is a site-local address.

Method: inet-address:get-native-size self ⇒ %return
Method: get-native-size self ⇒ %return

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().

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: an unsigned 64-bit integer.

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

Method: inet-address:get-scope-id self ⇒ %return
Method: get-scope-id self ⇒ %return

Gets the value of inet-address:scope-id.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: an unsigned 32-bit integer.

The scope-id for the address, 0 if unset or not IPv6 address.

Procedure: inet-address:new-any family ⇒ %return

Creates a <GInetAddress> for the "any" address (unassigned/"don’t care") for family.

family

Passed: a <GSocketFamily>, or one of its symbols.

the address family

%return

Returned: a <GInetAddress>.

a new <GInetAddress> corresponding to the "any" address for family. Free the returned object with object:unref.

Procedure: inet-address:new-from-bytes bytes family ⇒ %return

Creates a new <GInetAddress> from the given family and bytes. bytes should be 4 bytes for ipv4 and 16 bytes for ipv6.

bytes

Passed: a foreign pointer, or a bytevector.

raw address data

family

Passed: a <GSocketFamily>, or one of its symbols.

the address family of bytes

%return

Returned: a <GInetAddress>.

a new <GInetAddress> corresponding to family and bytes. Free the returned object with object:unref.

Procedure: inet-address:new-from-bytes-with-ipv6-info bytes family flowinfo scope-id ⇒ %return

Creates a new <GInetAddress> from the given family, bytes and scope-id.

bytes must be 4 bytes for Gio.SocketFamily.IPV4 and 16 bytes for Gio.SocketFamily.IPV6.

bytes

Passed: a foreign pointer, or a bytevector.

raw address data

family

Passed: a <GSocketFamily>, or one of its symbols.

the address family of bytes

flowinfo

Passed: an unsigned 32-bit integer.

scope-id

Passed: an unsigned 32-bit integer.

the scope-id of the address

%return

Returned: a <GInetAddress>.

a new internet address corresponding to family, bytes and scope-id

Procedure: inet-address:new-from-string string ⇒ %return

Parses string as an IP address and creates a new <GInetAddress>.

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.

string

Passed: a string.

a string representation of an IP address

%return

Returned: a <GInetAddress>, or #f.

a new <GInetAddress> corresponding to string, or #f if string could not be parsed. Free the returned object with object:unref.

Procedure: inet-address:new-loopback family ⇒ %return

Creates a <GInetAddress> for the loopback address for family.

family

Passed: a <GSocketFamily>, or one of its symbols.

the address family

%return

Returned: a <GInetAddress>.

a new <GInetAddress> corresponding to the loopback address for family. Free the returned object with object:unref.

Method: inet-address:to-string self ⇒ %return
Method: to-string self ⇒ %return

Converts self to string form.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a string.

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

Virtual methods

Virtual method: inet-address:do-to-string implementor self ⇒ %return

Converts self to string form.

To override it in a new class, give register-type #:vfuncs `((to-string . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GInetAddress>, or a class that derives from it, or its GType number.

self

Passed: a <GInetAddress>.

a <GInetAddress>

%return

Returned: a string.

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