ID EN
Socket

gethostbyname_ex

Python 3.11

Translate a host name to IPv4 address format, extended interface. Return a 3-tuple (hostname, aliaslist, ipaddrlist) where hostname is the host’s primary host name, aliaslist is a (possibly empty) list of alternative host names for the same address, and ipaddrlist is a list of IPv4 addresses for the same interface on the same host (often but not always a single address). gethostbyname_ex() does not support IPv6 name resolution, and getaddrinfo() should be used instead for IPv4/v6 dual stack support.

Syntax

PYTHON
socket.gethostbyname_ex(hostname)

See Also

gethostbyname_ex() getaddrinfo() auditing event Availability