# gevent

# Name Resolution (DNS)

gevent includes support for a pluggable hostname resolution system. Pluggable resolvers are (generally) intended to be cooperative. This pluggable resolution system is used automatically when the system is `monkey patched`, and may be used manually through the `resolver attribute` of the `gevent.hub.Hub` or the corresponding methods in the `gevent.socket` module.

A resolver implements the 5 standandard functions from the `socket` module for resolving hostnames:

- `socket.gethostbyname()`
- `socket.gethostbyname_ex()`
- `socket.getaddrinfo()`
- `socket.gethostbyaddr()`
- `socket.getnameinfo()`

## Configuration

gevent includes three implementations of resolvers, and applications can provide their own implementation. By default, gevent uses `gevent.resolver_thread.Resolver`.

Configuration can be done through the `GEVENT_RESOLVER` environment variable. Specify `ares`, `thread`, or `block` to use the `gevent.resolver_ares.Resolver`, `gevent.resolver_thread.Resolver`, or `gevent.socket.BlockingResolver`, respectively, or set it to the fully-qualified name of an implementation of the standard functions.

Next page: `gevent.subprocess` – Cooperative `subprocess` module