### Class

# Gio NetworkService

#### Description [src]

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

Like `GNetworkAddress` does with hostnames, `GNetworkService` provides an easy way to resolve a SRV record, and then attempt to connect to one of the hosts that implements that service, handling service priority/weighting, multiple IP addresses, and multiple address families.

See `GSrvTarget` for more information about SRV records, and see `GSocketConnectable` for an example of using the connectable interface.

#### Ancestors

- GObject

#### Implements

- GSocketConnectable

#### Constructors

###### g_network_service_new

Creates a new `GNetworkService` representing the given `service`, `protocol`, and `domain`. This will initially be unresolved; use the `GSocketConnectable` interface to resolve it.

since: 2.22

#### Instance methods

###### g_network_service_get_domain

Gets the domain that `srv` serves. This might be either UTF-8 or ASCII-encoded, depending on what `srv` was created with.

since: 2.22

###### g_network_service_get_protocol

Gets `srv`‘s protocol name (eg, “tcp”).

since: 2.22

###### g_network_service_get_scheme

Gets the URI scheme used to resolve proxies. By default, the service name is used as scheme.

since: 2.26

###### g_network_service_get_service

Gets `srv`‘s service name (eg, “ldap”).

since: 2.22

###### g_network_service_set_scheme

Set’s the URI scheme used to resolve proxies. By default, the service name is used as 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.NetworkService:domain

Network domain, for example `example.com`.

since: 2.22

###### Gio.NetworkService:protocol

Network protocol, for example `tcp`.

since: 2.22

###### Gio.NetworkService:scheme

Network scheme (default is to use service).

since: 2.22

###### Gio.NetworkService:service

Service name, for example `ldap`.

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 GioNetworkServiceClass {
      GObjectClass parent_class;

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.