lprasanna has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am recently writing code to migrate to IPV6 from IPV4 in perl. Before, I used to store the IPV4 address into an integer scalar since it was only 32-bit long. Now, i am trying to use a integer array of size 4 to store the 128-bit IPV6 address. Problem is when i convert IPV6 from string to network order using "inet_pton", the returned value is not stored in an array, it is a scalar variable. I need to pass an integer array of 4 which holds the IPV6 address to an RPC and so i want the IPV6 address to be stored in an array.

I am stuck here and unable to proceed.. Has anyone faced this problem before?? Please suggest a solution for this.... Any help would be greatly appreciated....

thanks,

Prasanna

  • Comment on how to store IPV6 network byte order address returned by inet_pton into an integer array?

Replies are listed 'Best First'.
Re: how to store IPV6 network byte order address returned by inet_pton into an integer array?
by salva (Canon) on Jul 14, 2010 at 06:43 UTC
    my @ints = unpack 'N*', inet_pton(...);
      thanks a lot......