+bool wxIPV6address::AnyAddress()
+{
+ return (GAddress_INET6_SetAnyAddress(m_address) == GSOCK_NOERROR);
+}
+
+wxString wxIPV6address::IPAddress() const
+{
+ unsigned char addr[16];
+ GAddress_INET6_GetHostAddress(m_address,(in6_addr*)addr);
+
+ wxUint16 words[8];
+ int i,
+ prefix_zero_count = 0;
+ for ( i = 0; i < 8; ++i )
+ {
+ words[i] = addr[i*2];
+ words[i] <<= 8;
+ words[i] |= addr[i*2+1];
+ if ( i == prefix_zero_count && words[i] == 0 )
+ ++prefix_zero_count;
+ }
+
+ wxString result;
+ if ( prefix_zero_count == 8 )
+ {
+ result = wxT( "::" );
+ }
+ else if ( prefix_zero_count == 6 && words[5] == 0xFFFF )
+ {
+ // IPv4 mapped
+ result.Printf("::ffff:%d.%d.%d.%d",
+ addr[12], addr[13], addr[14], addr[15]);
+ }
+ else // general case
+ {
+ result = ":";
+ for ( i = prefix_zero_count; i < 8; ++i )
+ {
+ result += wxString::Format(":%x", words[i]);
+ }
+ }
+
+ return result;
+}
+
+wxString wxIPV6address::Hostname() const
+{
+ char hostname[1024];
+ hostname[0] = 0;
+
+ if ( GAddress_INET6_GetHostName(m_address,
+ hostname,
+ WXSIZEOF(hostname)) != GSOCK_NOERROR )
+ return wxEmptyString;
+
+ return wxString::FromAscii(hostname);
+}
+
+unsigned short wxIPV6address::Service() const
+{
+ return GAddress_INET6_GetPort(m_address);
+}
+
+#endif // wxUSE_IPV6
+
+#if defined(__UNIX__) && !defined(__WINDOWS__) && !defined(__WINE__)