Skip to content

Instantly share code, notes, and snippets.

@jmorton
Created April 29, 2010 15:38
Show Gist options
  • Select an option

  • Save jmorton/383785 to your computer and use it in GitHub Desktop.

Select an option

Save jmorton/383785 to your computer and use it in GitHub Desktop.
def localhost
reverse_lookup "127.0.0.1"
end
require 'socket'
def reverse_lookup(address)
Socket.getaddrinfo address, 0, 'AF_UNSPEC', Socket::SOCK_STREAM
end
@jmorton

jmorton commented Apr 29, 2010

Copy link
Copy Markdown
Author
ruby-1.8.7-p249 > reverse_lookup("75.126.76.113")
=> [["AF_INET", 0, "75.126.76.113-static.reverse.softlayer.com", "75.126.76.113", 2, 1, 6]] 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment