string containing host name or numeric address
optional additional parameters, identified by type:
Array with one AddressInfo per socket address.
SocketOSException on failure, or SocketFeatureException if this functionality is not available on the current system.
1 // Roundtrip DNS resolution 2 auto results = getAddressInfo("www.digitalmars.com"); 3 assert(results[0].address.toHostNameString() == 4 "digitalmars.com"); 5 6 // Canonical name 7 results = getAddressInfo("www.digitalmars.com", 8 AddressInfoFlags.CANONNAME); 9 assert(results[0].canonicalName == "digitalmars.com"); 10 11 // IPv6 resolution 12 results = getAddressInfo("ipv6.google.com"); 13 assert(results[0].family == AddressFamily.INET6); 14 15 // Multihomed resolution 16 results = getAddressInfo("google.com"); 17 assert(results.length > 1); 18 19 // Parsing IPv4 20 results = getAddressInfo("127.0.0.1", 21 AddressInfoFlags.NUMERICHOST); 22 assert(results.length && results[0].family == 23 AddressFamily.INET); 24 25 // Parsing IPv6 26 results = getAddressInfo("::1", 27 AddressInfoFlags.NUMERICHOST); 28 assert(results.length && results[0].family == 29 AddressFamily.INET6);
Provides _protocol-independent translation from host names to socket addresses. If advanced functionality is not required, consider using getAddress for compatibility with older systems.