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.)
Using this rather than connect or connect_to_host allows SocketClient to determine when to use application-specific proxy protocols.
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.
this | |
uri |
A network URI |
default_port |
the default port to connect to |
cancellable |
a Cancellable, or null |
a SocketConnection on success, null on error. |