Converting an IP address to a number:
Posted
by Quandary
on Stack Overflow
See other posts from Stack Overflow
or by Quandary
Published on 2010-05-28T10:50:26Z
Indexed on
2010/05/28
10:51 UTC
Read the original article
Hit count: 197
Question:
When I convert the IP address 192.168.115.67 to a number, is it done like this:
192*256^3 + 168*256^2+115*256^1+67*256^0 = 3232265027
or like this:
192*256^0 + 168*256^1+115*256^2+67*256^3 = 1131653312
I find both variants online, and frankly it doesn't matter as long as reverse it according to the conversion process.
But I want to calculate the IP V6 from the IPv4 address, and it seems both variants are on the web...
resulting in different IPv6 addresses, and only one can be correct...
I use the 1131653312 variant, as 1131653312 is the variant .NET gives me, but 3232265027 is the variant I find on the web for IPv4 to IPv6 conversion...
© Stack Overflow or respective owner