接口 Dns


public interface Dns
A domain name service that resolves IP addresses for host names. Most applications will use the system DNS service, which is the default. Some applications may provide their own implementation to use a different DNS server, to prefer IPv6 addresses, to prefer IPv4 addresses, or to force a specific known IP address.

Implementations of this interface must be safe for concurrent use.

  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final Dns
    A DNS that uses InetAddress.getAllByName(java.lang.String) to ask the underlying operating system to lookup IP addresses.
  • 方法概要

    修饰符和类型
    方法
    说明
    lookup(String hostname)
    Returns the IP addresses of hostname, in the order they will be attempted by OkHttp.
  • 字段详细资料

  • 方法详细资料

    • lookup

      List<InetAddress> lookup(String hostname) throws UnknownHostException
      Returns the IP addresses of hostname, in the order they will be attempted by OkHttp. If a connection to an address fails, OkHttp will retry the connection with the next address until either a connection is made, the set of IP addresses is exhausted, or a limit is exceeded.
      抛出:
      UnknownHostException