本文整理汇总了C++中SystemAddress::GetIPVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ SystemAddress::GetIPVersion方法的具体用法?C++ SystemAddress::GetIPVersion怎么用?C++ SystemAddress::GetIPVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SystemAddress
的用法示例。
在下文中一共展示了SystemAddress::GetIPVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FixForIPVersion
void SystemAddress::FixForIPVersion(const SystemAddress &boundAddressToSocket)
{
char str[128];
ToString(false,str);
// TODO - what about 255.255.255.255?
if (strcmp(str, IPV6_LOOPBACK)==0)
{
if (boundAddressToSocket.GetIPVersion()==4)
{
FromString(IPV4_LOOPBACK,0,4);
}
}
else if (strcmp(str, IPV4_LOOPBACK)==0)
{
#if RAKNET_SUPPORT_IPV6==1
if (boundAddressToSocket.GetIPVersion()==6)
{
FromString(IPV6_LOOPBACK,0,6);
}
#endif
// if (boundAddressToSocket.GetIPVersion()==4)
// {
// // Some kind of bug with sendto: returns "The requested address is not valid in its context." if loopback doesn't have the same IP address
// address.addr4.sin_addr.s_addr=boundAddressToSocket.address.addr4.sin_addr.s_addr;
// }
}
}
示例2: FixForIPVersion
void SystemAddress::FixForIPVersion(const SystemAddress &boundAddressToSocket)
{
char str[128];
ToString(false,str);
if (strcmp(str, IPV6_LOOPBACK)==0)
{
if (boundAddressToSocket.GetIPVersion()==4)
{
FromString(IPV4_LOOPBACK,0,4);
}
}
else if (strcmp(str, IPV4_LOOPBACK)==0)
{
#if VENET_SUPPORT_IPV6==1
if (boundAddressToSocket.GetIPVersion()==6)
{
FromString(IPV6_LOOPBACK,0,6);
}
#endif
}
}