## 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);

## Object Hierarchy

      GObject
       +----GNetworkService

## Implemented Interfaces

GNetworkService implements GSocketConnectable.

## Properties

      "domain"                   gchar*                : Read / Write / Construct Only
      "protocol"                 gchar*                : Read / Write / Construct Only
      "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

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

## 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 `"service"` property

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

Service name, eg "ldap".

Default value: NULL