Getting the IP address of the local machine

If you want to keep your memory footprint down, I wrote a module called
Sys::Host which also does this (as well as allow you to grab the ip
addresses). It’s on the RAA.

I’m also hoping to add the ability to retrieve the virtual ip address (if
any).

Regards,

Dan

···

-----Original Message-----
From: Tom Sawyer [mailto:transami@transami.net]
Sent: Monday, September 09, 2002 5:12 AM
To: ruby-talk@ruby-lang.org
Subject: Re: getting the IP address of the local machine

thanks!

On Mon, 2002-09-09 at 04:05, WATANABE Hirofumi wrote:

Hi,

Tom Sawyer transami@transami.net writes:

does anyone know how to get the IP address of the machine
a ruby script
is running on?

require ‘socket’
ip_address = IPSocket.getaddress(Socket.gethostname)


eban


tom sawyer, aka transami
transami@transami.net