xtd 0.2.0
dns_get_host_addresses.cpp

Shows how to use xtd::net::dns class.

#include <xtd/net/dns>
#include <xtd/console>
using namespace xtd;
using namespace xtd::net;
auto main() -> int {
auto addresses = dns::get_host_addresses("www.google.com");
console::write_line("www.google.com addresses:");
for (auto address : addresses)
console::write_line(" * {}", address);
}
// This code produces the following output :
//
// www.google.com addresses:
// * 216.58.208.100
static void write_line()
Writes the current line terminator to the standard output stream using the specified format informati...
static xtd::array< xtd::net::ip_address > get_host_addresses(const xtd::string &host_name_or_address)
Returns the Internet Protocol (IP) addresses for the specified host.
The xtd::net namespace provides a simple programming interface for many of the protocols used on netw...
Definition cookie_exception.hpp:10
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8