socket_connect_auto.RdResolves address for both requested address families, tries endpoints in
prefer order, and creates a socket matching the endpoint that succeeds.
This is the address-aware alternative to an "auto" socket domain.
It supports IPv4 and IPv6 Internet sockets only; Unix-domain filesystem
paths are not resolved by this helper. Use type = "dgram" for UDP or the
default type = "stream" for TCP.
A hostname or numeric IP address.
A port between 0 and 65535, or NULL when embedded in a
bracketed endpoint such as "[::1]:12345".
Socket type: "stream" or "dgram".
Numeric protocol, usually zero.
Whether the socket should be nonblocking.
Whether to set close-on-exec.
Address families to try, in order.
A connected socketR handle.
if (interactive()) {
client <- socket_connect_auto("localhost", 80L)
socket_close(client)
}