How can I reverse DNS for Ruby?
host_name = Socket.gethostbyname(current_ip)
host_name = Socket.getaddrinfo(current_ip, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)[0][1]
Tags: ruby sockets dns nslookup
Source: By garg as answer to the question
This code snippet was collected from stackoverflow, and is licensed under CC BY-SA 3.0
Related code-snippets:
- How do I use the C socket API in C++ on Linux?
- When to use lambda and Proc.new?
- What is the best way to fix 'Unprocessed view path found' error with ExceptionNotifier plugin in rails 2.1?
- How do I make subdomain user accounts in a webapp?
- How can I modify a.xfdl file?
- How do I call shell commands in Ruby?
- In Ruby, I can map multiple arrays and values from one array to the other.
- How do you run a Rake task?
- What are the pros and cons of using MySQL instead of SQLite for Rails web development?
- How do I update Ruby Gems from behind a proxy (ISA-NTLM)?
- How do I create a class using Singleton Design Pattern in Ruby?
- How do you resolve a domain name to an IP address with.NET/C#?
- How do I block DNS mam sq from appending my domain name to invalid domain requests?
- Why doesn't Ruby have a StringBuffer?
- How do I write a command line program?