> Sijo Kg wrote:
> > Could you please tell the code to get the IPaddress of my machine

Another way to do this:

require 'ipaddr'
require 'net/http'

def get_ip
  con = Net::HTTP.new('checkip.dyndns.org', 80)
  resp,body = con.get("/", nil)
  ip = body.match(/\d+\.\d+\.\d+\.\d+/)

  ip[0]
end

my_ip = IPAddr.new(get_ip)

I had to do this as a work around before, though if I was working
around an issue with Socket.gethostname or my own ignorance I can no
longer tell ;)