I am using inet_aton
to convert IPv4 IP(216.12.207.142) to a string 3624718222. I use the following code for that:
ip_dec = unpack('>L', inet_aton(ip))[0]
Now I need to convert IPv6 ip 2001:23::207:142 to a similar string. It gives me error as it is not IPv4 address. How can I do this?