开发者

Gethostname and IPv6

开发者 https://www.devze.com 2022-12-30 02:35 出处:网络
Microsoft recommends not to use \'开发者_如何学Pythongethostname\' on IPv6 and instead use \'getaddrinfo\' or \'getnameinfo\'.

Microsoft recommends not to use '开发者_如何学Pythongethostname' 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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号