Gio.SocketClient.prototype.connect_to_service
function connect_to_service(domain: String, service: String, cancellable: Gio.Cancellable): Gio.SocketConnection { // Gjs wrapper for g_socket_client_connect_to_service() }
Attempts to create a TCP connection to a service.
This call looks up the SRV record for service at domain for the "tcp" protocol. It then attempts to connect, in turn, to each of the hosts providing the service until either a connection succeeds or there are no hosts remaining.
Upon a successful connection, a new Gio.SocketConnection is constructed and returned. The caller owns this new object and must drop their reference to it when finished with it.
In the event of any failure (DNS error, service not found, no hosts connectable) null is returned and @error (if non-null) is set accordingly.
- domain
a domain name
- service
the name of the service to connect to
- cancellable
a Gio.Cancellable, or null
- Returns
a Gio.SocketConnection if successful, or null on error