在Windows XP中是否有inet_ntop / InetNtop的替代方法? [英] Is there an alternative to inet_ntop / InetNtop in Windows XP?
问题描述
我试图编译beej的网络编程示例指南,但Windows XP没有这样的功能。
I'm trying to compile beej's guide to network programming examples, but Windows XP doesn't have such a function. I'm using mingw, if it makes any difference.
推荐答案
如果你只处理IPv4地址,你可以使用 inet_ntoa
。它在Windows 2000或更高版本上可用。否则你必须要求Vista或更高版本,或者编写自己的inet_ntop函数。
If you're only dealing with IPv4 addresses, you can use inet_ntoa
. It's available on Windows 2000 or later. Otherwise you'll have to either require Vista and later, or write your own inet_ntop function.
你也可以看boost:boost :: asio有一个 inet_ntop
在Windows中工作的实现: boost :: asio :: detail :: socket_ops :: inet_ntop
。您可以在此处查看源代码。
You could also look at boost - the boost::asio has an inet_ntop
implementation that works in Windows: boost::asio::detail::socket_ops::inet_ntop
. You can see the source code here.
这篇关于在Windows XP中是否有inet_ntop / InetNtop的替代方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!