Risolvere un nome host da un indirizzo IP in Ruby


Ecco un altro promemoria: come risolvere un nome host da un indirizzo IP in Ruby.

Per eseguire l’operazione viene in nostro aiuto la class Resolv.

Esempio (usando Rails):

hostname = Resolv.new.getname(request.env['REMOTE_ADDR'])

Risorse utili:
http://ruby-doc.org/stdlib/libdoc/resolv/rdoc/index.html

Articoli correlati

This entry was posted in Ruby and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">