[Wtr-general] How to get the localhost IP in Warit/Ruby

Chris McMahon christopher.mcmahon at gmail.com
Thu Mar 1 22:03:53 EST 2007


On 3/1/07, Jason He <Jason.He at resilience.com> wrote:

> Hi all,
>
>          Is there any available method to fetch the localhost's IP address?


irb(main):001:0> require 'socket'
=> true
irb(main):002:0> ip_address = IPSocket.getaddress(Socket.gethostname)
=> "192.168.2.106"
irb(main):003:0>


More information about the Wtr-general mailing list