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
(host, port, family=0, type=0, proto=0, flags=0)
| 943 | |
| 944 | |
| 945 | def getaddrinfo(host, port, family=0, type=0, proto=0, flags=0): |
| 946 | """Resolve host and port into list of address info entries. |
| 947 | |
| 948 | Translate the host/port argument into a sequence of 5-tuples that contain |
| 949 | all the necessary arguments for creating a socket connected to that service. |
| 950 | host is a domain name, a string representation of an IPv4/v6 address or |
| 951 | None. port is a string service name such as 'http', a numeric port number or |
| 952 | None. By passing None as the value of host and port, you can pass NULL to |
| 953 | the underlying C API. |
| 954 | |
| 955 | The family, type and proto arguments can be optionally specified in order to |
| 956 | narrow the list of addresses returned. Passing zero as a value for each of |
| 957 | these arguments selects the full range of results. |
| 958 | """ |
| 959 | # We override this function since we want to translate the numeric family |
| 960 | # and socket type values to enum constants. |
| 961 | addrlist = [] |
| 962 | for res in _socket.getaddrinfo(host, port, family, type, proto, flags): |
| 963 | af, socktype, proto, canonname, sa = res |
| 964 | addrlist.append((_intenum_converter(af, AddressFamily), |
| 965 | _intenum_converter(socktype, SocketKind), |
| 966 | proto, canonname, sa)) |
| 967 | return addrlist |
no test coverage detected