One way to do this is to get a pointer to the core.sys.posix.sys.socket.sockaddr structure using the Address.name.
Something like auto saddr_ptr = results[0].address.name; would do. Then you can extract the data you need by casting this pointer to a pointer of appropriate type (depending on the address family).
Here is a modified example from getAddress() documentation which uses sockaddr* to give you addresses as uint32_t values and conver them to ubyte[4] arrays:
module main;
import std.stdio;
import std.socket;
import std.c.linux.socket: sockaddr_in, in_addr;
void main(string[] args) {
// auto results = getAddressInfo("www.digitalmars.com");
try {
Address[] addresses = getAddress("dlang.org", 80);
writefln(" %d addresses found.", addresses.length);
foreach (int i, Address a; addresses) {
writefln(" Address %d:", i+1);
writefln(" IP address: %s", a.toAddrString());
writefln(" Hostname: %s", a.toHostNameString());
writefln(" Port: %s", a.toPortString());
writefln(" Service name: %s", a.toServiceNameString());
auto saddr_ptr = a.name;
auto in_ptr = *(cast(sockaddr_in*) saddr_ptr);
// let's convert it to ubyte[4] so we can access individual
// parts of the IPv4 address.
writeln(cast(ubyte[4])(in_ptr.sin_addr));
}
} catch (SocketException e) {
writefln(" Lookup error: %s", e.msg);
}
// Lets the user press <Return> before program returns
stdin.readln();
}
Output:
3 addresses found.
Address 1:
IP address: 162.217.114.56
Hostname: digitalmars.com
Port: 80
Service name: http
[162, 217, 114, 56]
Address 2:
IP address: 162.217.114.56
Hostname: digitalmars.com
Port: 80
Service name: http
[162, 217, 114, 56]
Address 3:
IP address: 162.217.114.56
Hostname: digitalmars.com
Port: 80
Service name: http
[162, 217, 114, 56]