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;
// 		}
    }
}
Esempio n. 2
0
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

    }
}