Back to Seed Clases

Gio


Classes

Interfaces

Structs

Unions

Enums

Interface Gio.SocketConnectable

Import line: Gio = imports.gi.Gio;
GIR File: Gio-2.0.gir
C documentation: GSocketConnectable
Interface : SocketConnectable
Implementations: Gio.InetSocketAddress, Gio.NetworkAddress, Gio.NetworkService, Gio.ProxyAddress, Gio.SocketAddress, Gio.UnixSocketAddress
Objects that describe one or more potential socket endpoints
implement GSocketConnectable. Callers can then use
g_socket_connectable_enumerate() to get a GSocketAddressEnumerator
to try out each socket address in turn until one succeeds, as shown
in the sample code below.
|[
MyConnectionType *
connect_to_host (const char *hostname,
guint16 port,
GCancellable *cancellable,
GError **error)
{
MyConnection *conn = NULL;
GSocketConnectable *addr;
GSocketAddressEnumerator *enumerator;
GSocketAddress *sockaddr;
GError *conn_error = NULL;
addr = g_network_address_new ("www.gnome.org", 80);
enumerator = g_socket_connectable_enumerate (addr);
g_object_unref (addr);
/* Try each sockaddr until we succeed. Record the first
* connection error, but not any further ones (since they'll probably
* be basically the same as the first).
*/
while (!conn && (sockaddr = g_socket_address_enumerator_next (enumerator, cancellable, error))
{
g_object_unref (sockaddr);
}
g_object_unref (enumerator);
if (conn)
{
if (conn_error)
{
/* We couldn't connect to the first address, but we succeeded
* in connecting to a later address.
*/
g_error_free (conn_error);
}
return conn;
}
else if (error)
{
/* Either the initial lookup failed, or else the caller
* cancelled us.
*/
if (conn_error)
g_error_free (conn_error);
return NULL;
}
else
{
g_error_propagate (error, conn_error);
return NULL;
}
}
]|
Properties
None
Methods / Constructors
Method / Constructor Defined By
Events
None
Used by These Methods / Signals / Properties
Class / Namespace Method / Signal / Properties
Gio.NetworkAddress
Method
Gio.NetworkAddress.c_new (String hostname, guint16 port) : Gio.SocketConnectable
Creates a new GSocketConnectable for connecting to the given
Gio.NetworkAddress
Method
Gio.NetworkAddress.parse (String host_and_port, guint16 default_port) : Gio.SocketConnectable
Creates a new GSocketConnectable for connecting to the given
parsing host_and_port fails.
Gio.NetworkAddress
Method
Gio.NetworkAddress.parse_uri (String uri, guint16 default_port) : Gio.SocketConnectable
Creates a new GSocketConnectable for connecting to the given
Using this rather than g_network_address_new() or
g_network_address_parse_host() allows GSocketClient to determine
when to use application-specific proxy protocols.
Gio.NetworkService
Method
Gio.NetworkService.c_new (String service, String protocol, String domain) : Gio.SocketConnectable
Creates a new GNetworkService representing the given service,
GSocketConnectable interface to resolve it.
Gio.ProxyAddressEnumerator
Property
connectable : Gio.SocketConnectable
Gio.SocketClient
Method
connect (SocketConnectable connectable, Cancellable cancellable) : Gio.SocketConnection
Tries to resolve the connectable and make a network connection to it.
Gio.SocketClient
Method
connect_async (SocketConnectable connectable, Cancellable cancellable, Function callback, void* user_data) : none
This is the asynchronous version of g_socket_client_connect().
Gio.TlsCertificate
Method
verify (SocketConnectable identity, TlsCertificate trusted_ca) : Gio.TlsCertificateFlags
This verifies cert and returns a set of GTlsCertificateFlags
indicating any problems found with it.
Gio.TlsClientConnection
Property
server_identity : Gio.SocketConnectable
A GSocketConnectable describing the identity of the server that
is expected on the other end of the connection.
Gio.TlsClientConnection
Method
set_server_identity (SocketConnectable identity) : none
Sets conn's expected server identity, which is used both to tell
servers on virtual hosts which certificate to present, and also
to let conn know what name to look for in the certificate when
performing G_TLS_CERTIFICATE_BAD_IDENTITY validation, if enabled.
Documentation generated by Introspection Doc Generator Loosely Based on JsDoc Toolkit on Sat Apr 16 2011 17:11:23 GMT+0800 (HKT)