Gio.NetworkAddress
Description: Reference for Gio.NetworkAddress

### Class

# GioNetworkAddress

#### Description [src]

    class Gio.NetworkAddress : GObject.Object
      implements Gio.SocketConnectable {
      /* No available fields */
    }

`GNetworkAddress` provides an easy way to resolve a hostname and then attempt to connect to that host, handling the possibility of multiple IP addresses and multiple address families.

The enumeration results of resolved addresses may be cached as long as this object is kept alive which may have unexpected results if alive for too long.

See `GSocketConnectable` for an example of using the connectable interface.

#### Hierarchy

#### Ancestors

- GObject

#### Implements

- GSocketConnectable

#### Constructors

###### g_network_address_new

Creates a new `GSocketConnectable` for connecting to the given `hostname` and `port`.

since: 2.22

###### g_network_address_new_loopback

Creates a new `GSocketConnectable` for connecting to the local host over a loopback connection to the given `port`. This is intended for use in connecting to local services which may be running on IPv4 or IPv6.

since: 2.44

#### Functions

###### g_network_address_parse

Creates a new `GSocketConnectable` for connecting to the given `hostname` and `port`. May fail and return `NULL` in case parsing `host_and_port` fails.

since: 2.22

###### g_network_address_parse_uri

Creates a new `GSocketConnectable` for connecting to the given `uri`. May fail and return `NULL` in case parsing `uri` fails.

since: 2.26

#### Instance methods

###### g_network_address_get_hostname

Gets `addr`‘s hostname. This might be either UTF-8 or ASCII-encoded, depending on what `addr` was created with.

since: 2.22

###### g_network_address_get_port

Gets `addr`‘s port number.

since: 2.22

###### g_network_address_get_scheme

Gets `addr`‘s scheme.

since: 2.26

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from GSocketConnectable (3)

###### g_socket_connectable_enumerate

Creates a `GSocketAddressEnumerator` for `connectable`.

since: 2.22

###### g_socket_connectable_proxy_enumerate

Creates a `GSocketAddressEnumerator` for `connectable` that will return a `GProxyAddress` for each of its addresses that you must connect to via a proxy.

since: 2.26

###### g_socket_connectable_to_string

Format a `GSocketConnectable` as a string. This is a human-readable format for use in debugging output, and is not a stable serialization format. It is not suitable for use in user interfaces as it exposes too much information for a user.

since: 2.48

#### Properties

###### Gio.NetworkAddress:hostname

Hostname to resolve.

since: 2.22

###### Gio.NetworkAddress:port

Network port.

since: 2.22

###### Gio.NetworkAddress:scheme

URI scheme.

since: 2.22

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct GioNetworkAddressClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.