Attempts to retrieve the host address as a human-readable string.
Attempts to retrieve the host name as a fully qualified domain name.
Attempts to retrieve the numeric port number as a string.
Attempts to retrieve the service name as a string.
Human readable string representing this address.
Family of this address.
Returns pointer to underlying sockaddr structure.
Returns actual size of underlying sockaddr structure.
1 writeln("About www.google.com port 80:"); 2 try 3 { 4 Address[] addresses = getAddress("www.google.com", 80); 5 writefln(" %d addresses found.", addresses.length); 6 foreach (int i, Address a; addresses) 7 { 8 writefln(" Address %d:", i+1); 9 writefln(" IP address: %s", a.toAddrString()); 10 writefln(" Hostname: %s", a.toHostNameString()); 11 writefln(" Port: %s", a.toPortString()); 12 writefln(" Service name: %s", 13 a.toServiceNameString()); 14 } 15 } 16 catch (SocketException e) 17 writefln(" Lookup error: %s", e.msg);
Address is an abstract class for representing a socket addresses.