Library: Net
Package: NetCore
Header: Poco/Net/DNS.h
This class provides an interface to the domain name service.
An internal DNS cache is used to speed up name lookups.
Member Functions: error, flushCache, hostByAddress, hostByName, hostName, lastError, resolve, resolveOne, thisHost
 
 static void flushCache();
Flushes the internal DNS cache.
 
 static const HostEntry & hostByAddress(
    const IPAddress & address
);
Returns a HostEntry object containing the DNS information for the host with the given IP address.
Throws a HostNotFoundException if a host with the given name cannot be found.
Throws a DNSException in case of a general DNS error.
Throws an IOException in case of any other error.
 
 static const HostEntry & hostByName(
    const std::string & hostname
);
Returns a HostEntry object containing the DNS information for the host with the given name.
Throws a HostNotFoundException if a host with the given name cannot be found.
Throws a NoAddressFoundException if no address can be found for the hostname.
Throws a DNSException in case of a general DNS error.
Throws an IOException in case of any other error.
 
 static std::string hostName();
Returns the host name of this host.
 
 static const HostEntry & resolve(
    const std::string & address
);
Returns a HostEntry object containing the DNS information for the host with the given IP address or host name.
Throws a HostNotFoundException if a host with the given name cannot be found.
Throws a NoAddressFoundException if no address can be found for the hostname.
Throws a DNSException in case of a general DNS error.
Throws an IOException in case of any other error.
 
 static IPAddress resolveOne(
    const std::string & address
);
Convenience method that calls resolve(address) and returns the first address from the HostInfo.
 
 static const HostEntry & thisHost();
Returns a HostEntry object containing the DNS information for this host.
Throws a HostNotFoundException if DNS information for this host cannot be found.
Throws a NoAddressFoundException if no address can be found for this host.
Throws a DNSException in case of a general DNS error.
Throws an IOException in case of any other error.
 
   
 static void error(
    int code,
    const std::string & arg
);
Throws an exception according to the error code.
 
   
 static int lastError();
Returns the code of the last error.