This is a helper function for connect.
Attempts to create a TCP connection to the named host.
host_and_port may be in any of a number of recognized formats; an IPv6 address, an IPv4 address, or a domain name (in which case a
DNS lookup is performed). Quoting with  is supported for all address types. A port override may be specified in the usual way with a colon.
Ports may be given as decimal numbers or symbolic names (in which case an /etc/services lookup is performed).
If no port override is given in
default_port will be used as the port number to connect to.
host_and_port is expected to be provided by the user (allowing them to give the hostname, and a port override if
default_port is expected to be provided by the application.
In the case that an IP address is given, a single connection attempt is made. In the case that a name is given, multiple connection attempts may be made, in turn and according to the number of address records in DNS, until a connection succeeds.
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.
the name and optionally port of the host to connect to
the default port to connect to
a Cancellable, or null
a SocketConnection on success, null on error.