views:

86

answers:

1

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?

+2  A: 

The main different is the maximum host name length, gethostname() allows 255+1 characters, getnameinfo() supports the full DNS length of 1024+1. If you are using technologies like puny code host names this becomes more pertinent. Other differences are that you are not guaranteed a FQDN when using gethostname().

http://en.wikipedia.org/wiki/Internationalized_domain_name

Steve-o
+1 Where can you find out about this? I need to improve my Google-Fu :(
Skurmedel
Check the remarks section for each function on MSDN, or the manpage in Unix.
Steve-o