Microsoft recommends not to use 'gethostname' on IPv6 and instead use 'getaddrinfo' or 'getnameinfo'.
http://msdn.microsoft.com/en-us/library/ms899604.aspx
But 'gethostname' doesn't seem to have any problem working on IPv6. Does anyone know any reason why 'gethostname' is not recommended on IPv6?