diff --git a/std/socket.d b/std/socket.d index 99ac97ac1e3..e48bf565971 100644 --- a/std/socket.d +++ b/std/socket.d @@ -1284,7 +1284,7 @@ abstract class Address // libraries shipped with DMD. Thus, we check for getnameinfo at // runtime in the shared module constructor, and use it if it's // available in the base class method. Classes for specific network - // families (e.g. InternetHost) override this method and use a + // families (e.g. InternetAddress) override this method and use a // deprecated, albeit commonly-available method when getnameinfo() // is not available. // http://technet.microsoft.com/en-us/library/aa450403.aspx @@ -1863,6 +1863,19 @@ public: sin6 = addr; } + version (Posix) + { + /// Human readable string representing the IPv6 address in RFC 2373 form. + override string toAddrString() @trusted const + { + char[INET6_ADDRSTRLEN] buf; + string addrString = to!string( + .inet_ntop(AddressFamily.INET6, &sin6.sin6_addr, buf.ptr, INET6_ADDRSTRLEN) + ); + return addrString; + } + } + /** * Parse an IPv6 host address string as described in RFC 2373, and return the * address.