From: Nicolas Vincent Date: 2009-12-17T23:23:31+09:00 Subject: Re: How to unpack an IP packed in little endian byte order Robert Klemme wrote: > 2009/12/17 Nicolas Vincent : >> BigNum stored in the database : 3232235797 >> Resulting IP : 192.168.1.21 >> >> Could you give me some ideas or code ? I'm really stucked ! > > Do you mean like this: > > irb(main):020:0> i > => 3232235797 > irb(main):021:0> ([i].pack("N")).unpack("C*") > => [192, 168, 1, 21] > irb(main):022:0> ([i].pack("N")).unpack("C*").join(".") > => "192.168.1.21" > irb(main):023:0> > > Cheers > > robert That's exactly it. Thanks a lot Robert, you saved my day ! -- Posted via http://www.ruby-forum.com/.