def _families_and_addresses(self, hostname, port):
guess = True<EOL>addrinfos = socket.getaddrinfo(<EOL>hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM<EOL>)<EOL>for (family, socktype, proto, canonname, sockaddr) in addrinfos:<EOL><INDENT>if socktype == socket.SOCK_STREAM:<EOL><INDENT>yield family, sockaddr<EOL>guess = False<EOL><DEDENT><DEDENT>if guess:<EOL><INDENT>for family, _, _, _, sockaddr in addrinfos:<EOL><INDENT>yield family, sockaddr<EOL><DEDENT><DEDENT>
Yield pairs of address families and addresses to try for connecting.

:param str hostname: the server to connect to
:param int port: the server port to connect to
:returns: Yields an iterable of ``(family, address)`` tuples