Win XP中的AF

编程入门 行业动态 更新时间:2024-10-23 19:33:08
本文介绍了Win XP中的AF_INET与Win 7中的AF_INET6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好 我在示例应用程序中编写了代码.

Hi all i wrote a code in sample application.

char szHostName[255]; int iEc = -1; addrinfo* pAdInfo = NULL; // get the local hostname if( gethostname(szHostName, 255) == SOCKET_ERROR ) { return ; } CString sTmp(szHostName); ::AfxMessageBox(sTmp); iEc = getaddrinfo(szHostName, NULL, NULL, &pAdInfo); if( S_OK == iEc ) { sTmp.Format(_T("family[%d]"),pAdInfo->ai_family); ::AfxMessageBox(sTmp); }

它在窗口7中提供了不同的家庭,在窗口XP中提供了不同的家庭 胜利7:AF_INET6 赢得XP; AF_INET 我的问题是我怎样才能在两者中获得相同的ip4. Thankyou

It gives different family in window 7 and different family in window XP win 7 : AF_INET6 win xp; AF_INET my question how can i can get the same ip4 in both. thankyou

推荐答案

传递addrinfo结构以指定类型(IPv4或IPv6).请参见 getaddrinfo() [ ^ ]函数和 addrinfo [ ^ ]结构.当不传递任何addrinfo 结构或将ai_family成员设置为AF_UNSPEC时,返回的族类型在安装时(始终在Vista和更高版本中)为IPv6. Pass an addrinfo structure to specify the type (IPv4 or IPv6). See the getaddrinfo()[^] function and the addrinfo[^] structure. When passing no addrinfo structure or setting the ai_family member to AF_UNSPEC, the returned family type is IPv6 when it is installed (always with Vista and later).

更多推荐

Win XP中的AF

本文发布于:2023-11-26 21:03:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1635189.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Win   XP   AF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!