Gethostname and IPv6

Microsoft recommends not using "gethostname" on IPv6 and instead using "getaddrinfo" or "getnameinfo".

http://msdn.microsoft.com/en-us/library/ms899604.aspx

But "gethostname" doesn't seem to work on IPv6. Does anyone know why "gethostname" is deprecated on IPv6?

+2


a source to share


1 answer


The main difference is the maximum hostname length, gethostname()

allows 255 + 1 characters, getnameinfo()

supports the full DNS length of 1024 + 1. If you are using technologies such as narrow code hostnames, this becomes more appropriate. Other differences are that you are not guaranteed a fully qualified domain name when using gethostname()

.



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

+3


a source







All Articles