## GNetworkService GNetworkService — A GSocketConnectable for resolving SRV records |

## Synopsis

    #include <gio/gio.h>

                        GNetworkService;
    GSocketConnectable * g_network_service_new              (const gchar *service,
                                                             const gchar *protocol,
                                                             const gchar *domain);
    const gchar *       g_network_service_get_service       (GNetworkService *srv);
    const gchar *       g_network_service_get_protocol      (GNetworkService *srv);
    const gchar *       g_network_service_get_domain        (GNetworkService *srv);
    const gchar *       g_network_service_get_scheme        (GNetworkService *srv);
    void                g_network_service_set_scheme        (GNetworkService *srv,
                                                             const gchar *scheme);

## Object Hierarchy

      GObject
       +----GNetworkService

## Implemented Interfaces

GNetworkService implements GSocketConnectable.

## Properties

      "domain"                   gchar*                : Read / Write / Construct Only
      "protocol"                 gchar*                : Read / Write / Construct Only
      "scheme"                   gchar*                : Read / Write
      "service"                  gchar*                : Read / Write / Construct Only

## Description

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 and example of using the connectable interface.

## Details

### GNetworkService

    typedef struct _GNetworkService GNetworkService;

A GSocketConnectable for resolving a SRV record and connecting to that service.

### g_network_service_new ()

    GSocketConnectable * g_network_service_new              (const gchar *service,
                                                             const gchar *protocol,
                                                             const gchar *domain);

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

`service` : | the service type to look up (eg, "ldap")
`protocol` : | the networking protocol to use for `service` (eg, "tcp")
`domain` : | the DNS domain to look up the service in
Returns : | a new GNetworkService. [transfer full][type GNetworkService]

Since 2.22

### g_network_service_get_service ()

    const gchar *       g_network_service_get_service       (GNetworkService *srv);

Gets `srv`'s service name (eg, "ldap").

`srv` : | a GNetworkService
Returns : | `srv`'s service name

Since 2.22

### g_network_service_get_protocol ()

    const gchar *       g_network_service_get_protocol      (GNetworkService *srv);

Gets `srv`'s protocol name (eg, "tcp").

`srv` : | a GNetworkService
Returns : | `srv`'s protocol name

Since 2.22

### g_network_service_get_domain ()

    const gchar *       g_network_service_get_domain        (GNetworkService *srv);

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

`srv` : | a GNetworkService
Returns : | `srv`'s domain name

Since 2.22

### g_network_service_get_scheme ()

    const gchar *       g_network_service_get_scheme        (GNetworkService *srv);

Get's the URI scheme used to resolve proxies. By default, the service name is used as scheme.

`srv` : | a GNetworkService
Returns : | `srv`'s scheme name

Since 2.26

### g_network_service_set_scheme ()

    void                g_network_service_set_scheme        (GNetworkService *srv,
                                                             const gchar *scheme);

Set's the URI scheme used to resolve proxies. By default, the service name is used as scheme.

`srv` : | a GNetworkService
`scheme` : | a URI scheme

Since 2.26

## Property Details

### The `"domain"` property

      "domain"                   gchar*                : Read / Write / Construct Only

Network domain, eg, "example.com".

Default value: NULL

### The `"protocol"` property

      "protocol"                 gchar*                : Read / Write / Construct Only

Network protocol, eg "tcp".

Default value: NULL

### The `"scheme"` property

      "scheme"                   gchar*                : Read / Write

Network scheme (default is to use service).

Default value: NULL

### The `"service"` property

      "service"                  gchar*                : Read / Write / Construct Only

Service name, eg "ldap".

Default value: NULL