ID EN
Socket

gethostbyaddr

Python 3.11

Return a 3-tuple (hostname, aliaslist, ipaddrlist) where hostname is the primary host name responding to the given ip_address, aliaslist is a (possibly empty) list of alternative host names for the same address, and ipaddrlist is a list of IPv4/v6 addresses for the same interface on the same host (most likely containing only a single address). To find the fully qualified domain name, use the function getfqdn(). gethostbyaddr() supports both IPv4 and IPv6.

Syntax

PYTHON
socket.gethostbyaddr(ip_address)

See Also

getfqdn() gethostbyaddr() auditing event Availability