public SocketConnection connect_to_uri (string uri, uint16 default_port, Cancellable? cancellable = null) throws Error
This is a helper function for connect.
Attempts to create a TCP connection with a network URI.
uri may be any valid URI containing an "authority" (hostname/port) component. If a port is not specified in the URI,
default_port will be used. TLS will be negotiated if tls is
true. (SocketClient does not know to automatically
assume TLS for certain URI schemes.)
Upon a successful connection, a new 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 throws (if non-null) is set accordingly.
A network URI
the default port to connect to
a Cancellable, or null
a SocketConnection on success, null on error.