I have an IPv6 like:
2001:cdba::3257:9652
I want get IPv6 in full format like:
2001:cdba:0000:0000:0000:0000:3257:9652
Does has any function in java to do that? And how to compress a IPv6 full format? Thanks all.
I have an IPv6 like:
2001:cdba::3257:9652
I want get IPv6 in full format like:
2001:cdba:0000:0000:0000:0000:3257:9652
Does has any function in java to do that? And how to compress a IPv6 full format? Thanks all.
i do with this function
$ip ="2001:db0:0:123a:0:0:0:30";
function expand($ip){
$hex = unpack("H*hex", inet_pton($ip));
$ip = substr(preg_replace("/([A-f0-9]{4})/", "$1:", $hex['hex']), 0, -1);
return $ip;
}
$rt = expand($ip);
echo "<br>".$rt."<br>";//2001:0db0:0000:123a:0000:0000:0000:0030