On this page
  1. socket.gethostbyaddr
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

socket.gethostbyaddr

Prev: socket.getfqdn | Up: socket | Next: socket.gethostbyname
Rel: socket.AddressFamily, socket.close, socket.create_connection, socket.create_server
Ref: docs.python.org — socket.gethostbyaddr
Tags: #public #python3 #stdlib #socket


Import

import socket
from socket import gethostbyaddr

Signature & Overview

socket.gethostbyaddr(host) -> (name, aliaslist, addresslist)

Return the true host name, a list of aliases, and a list of IP addresses, for a host. The host argument is a string giving a host name or IP number.

Usage

import socket

# Reverse DNS lookup returning (hostname, aliaslist, ipaddrlist)
assert callable(socket.gethostbyaddr)

Gotchas

REPL Inspect

from socket import gethostbyaddr
help(gethostbyaddr)

Linked from

Related notes