On Tuesday, 4 February 2014 at 13:02:26 UTC, TheFlyingFiddle wrote:
I'm trying to find my own ip address using std.socket with little success. How would i go about doing this? (It should be a AddressFamily.INET socket)

This program will print all of your computer's IP addresses:

import std.socket;
import std.stdio;

void main()
{
        foreach (addr; getAddress(Socket.hostName))
                writeln(addr.toAddrString());
}

This includes IPv6 addresses. You can filter the address family by checking addr's addressFamily property.

Reply via email to