From: Eric Schwartz Date: 2003-07-12T04:36:43+09:00 Subject: Re: Getting my IP address ts writes: > >>>>> "P" == Philip Mak writes: > P> Is there a piece of Ruby code somewhere that will tell me what my IP > P> address is, and will work on at least Linux, Windows and MacOS X? > > svg% ruby -rsocket -e 'p IPSocket.getaddress(Socket.gethostname)' > "138.102.114.196" That only seems to work for the first IP address. It's not at all uncommon for a box to have multiple IP addresses bound to one interface (very common on a MacOS X box -- Rendezvous requires this), and it's at least as common to have multiple interfaces on the same machine. How this for a better question: How can I get, through Ruby, the IP addresses bound to each of the interfaces on this computer? -=Eric -- Come to think of it, there are already a million monkeys on a million typewriters, and Usenet is NOTHING like Shakespeare. -- Blair Houghton.