getAddress

fnAddress[] getAddress(scope const(char)[] hostname, scope const(char)[] service = null)

Provides _protocol-independent translation from host names to socket addresses. Uses getAddressInfo if the current system supports it, and InternetHost otherwise.

Returns

Array with one Address instance per socket address.

Throws

SocketOSException on failure.

Example:

writeln("Resolving www.digitalmars.com:");
try
{
   auto addresses = getAddress("www.digitalmars.com");
   foreach (address; addresses)
       writefln("  IP: %s", address.toAddrString());
}
catch (SocketException e)
   writefln("  Lookup failed: %s", e.msg);

fnAddress[] getAddress(scope const(char)[] hostname, ushort port)

ditto