Resolve host and port into list of address info entries. Translate the host/port argument into a sequence of 5-tuples that contain all the necessary arguments for creating a socket connected to that service. host is a domain name, a string representation of an IPv4/v6 address or Non
(host, port, family=0, type=0, proto=0, flags=0)
| 973 | |
| 974 | |
| 975 | def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0): |
| 976 | """Resolve host and port into list of address info entries. |
| 977 | |
| 978 | Translate the host/port argument into a sequence of 5-tuples that contain |
| 979 | all the necessary arguments for creating a socket connected to that service. |
| 980 | host is a domain name, a string representation of an IPv4/v6 address or |
| 981 | None. port is a string service name such as 'http', a numeric port number or |
| 982 | None. By passing None as the value of host and port, you can pass NULL to |
| 983 | the underlying C API. |
| 984 | |
| 985 | The family, type and proto arguments can be optionally specified in order to |
| 986 | narrow the list of addresses returned. Passing zero as a value for each of |
| 987 | these arguments selects the full range of results. |
| 988 | """ |
| 989 | # We override this function since we want to translate the numeric family |
| 990 | # and socket type values to enum constants. |
| 991 | addrlist = [] |
| 992 | for res in _socket.getaddrinfo(host, port, family, type, proto, flags): |
| 993 | af, socktype, proto, canonname, sa = res |
| 994 | addrlist.append((_intenum_converter(af, AddressFamily), |
| 995 | _intenum_converter(socktype, SocketKind), |
| 996 | proto, canonname, sa)) |
| 997 | return addrlist |
no test coverage detected
searching dependent graphs…