The connecting code was using GetHostEntryAsync when resolving IP address which does unnecessary reverse DNS lookups. Using GetHostAddressesAsync retrieves just the IPs. There's also a fast path when IP address is passed to method.
When using host name there's also optional address family parameter to allow selecting IPv4 or IPv6 address when only one of the two is supported.
I also added the optional timeout for all overloads to allow passing in from different connecting methods.
The connecting code was using GetHostEntryAsync when resolving IP address which does unnecessary reverse DNS lookups. Using GetHostAddressesAsync retrieves just the IPs. There's also a fast path when IP address is passed to method.
When using host name there's also optional address family parameter to allow selecting IPv4 or IPv6 address when only one of the two is supported.
I also added the optional timeout for all overloads to allow passing in from different connecting methods.