开发者

gethostbyname replacement for IPv6 addresses

开发者 https://www.devze.com 2022-12-26 06:38 出处:网络
I have a program that uses gethostbyname (in Windows) in order to convert IP address to hostname. But, it works only for IPv4...

I have a program that uses gethostbyname (in Windows) in order to convert IP address to hostname.

But, it works only for IPv4...

What is the correct replacem开发者_C百科ent for IPv6?

Thanks.


Looking up gethostbyname in MSDN tells us that it's deprecated and we should look at getaddrinfo, which has all kinds of options for dealing with other addressing families.

Or if you're doing address to name translation, you'll end up at getnameinfo


Use getaddrinfo, which deprecates the old gethostbyname function.

0

精彩评论

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