Skip to content
Back to top

# `gevent.resolver.blocking` – Non-cooperative resolver

class Resolver(hub=None)

  Bases: `object`

  A resolver that directly uses the system’s resolver functions.

  Caution

  This resolver is not cooperative.

  This resolver has the lowest overhead of any resolver and typically approaches the speed of the unmodified `socket` functions. However, it is not cooperative, so if name resolution blocks, the entire thread and all its greenlets will be blocked.

  This can be useful during debugging, or it may be a good choice if your operating system provides a good caching resolver (such as macOS’s Directory Services) that is usually very fast and functionally non-blocking.

  Changed in version 1.3a2: This was previously undocumented and existed in `gevent.socket`.

  static getaddrinfo(host, port[, family, type, proto, flags])

    -> list of (family, type, proto, canonname, sockaddr)

    Resolve host and port into addrinfo struct.

  static gethostbyaddr(host)

    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.

  static gethostbyname(host) → address

    Return the IP address (a string of the form ‘255.255.255.255’) for a host.

  static gethostbyname_ex(host)

    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.

  static getnameinfo(sockaddr, flags) --> (host, port)

    Get host and port for a sockaddr.