| GIO Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Implemented Interfaces | Properties | ||||
#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);
"domain" gchar* : Read / Write / Construct Only "protocol" gchar* : Read / Write / Construct Only "scheme" gchar* : Read / Write "service" gchar* : Read / Write / Construct Only
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.
typedef struct _GNetworkService GNetworkService;
A GSocketConnectable for resolving a SRV record and connecting to that service.
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.
|
the service type to look up (eg, "ldap") |
|
the networking protocol to use for service (eg, "tcp") |
|
the DNS domain to look up the service in |
Returns : |
a new GNetworkService. [transfer full] |
Since 2.22
const gchar * g_network_service_get_service (GNetworkService *srv);
Gets srv's service name (eg, "ldap").
|
a GNetworkService |
Returns : |
srv's service name |
Since 2.22
const gchar * g_network_service_get_protocol (GNetworkService *srv);
Gets srv's protocol name (eg, "tcp").
|
a GNetworkService |
Returns : |
srv's protocol name |
Since 2.22
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.
|
a GNetworkService |
Returns : |
srv's domain name |
Since 2.22
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.
|
a GNetworkService |
Returns : |
srv's scheme name |
Since 2.26
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.
|
a GNetworkService |
|
a URI scheme |
Since 2.26
"domain" property"domain" gchar* : Read / Write / Construct Only
Network domain, eg, "example.com".
Default value: NULL
"protocol" property"protocol" gchar* : Read / Write / Construct Only
Network protocol, eg "tcp".
Default value: NULL
"scheme" property"scheme" gchar* : Read / Write
Network scheme (default is to use service).
Default value: NULL
"service" property"service" gchar* : Read / Write / Construct Only
Service name, eg "ldap".
Default value: NULL