[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: TCPSocket.gethostbyname difficulties

Nathaniel Talbott

9/26/2003 2:46:00 PM

ts [mailto:decoux@moulon.inra.fr] wrote:

> You are right, you can't use DNS. You can try
>
> svg% ruby -rsocket -e 'p
> Socket::getnameinfo(["AF_INET",80,"noblepack.com"])'
> ["205.178.141.161", "http"]
> svg%

Excellent! That's what I was looking for. Since I don't want to worry about
the port at this point, I've just used 0:

ntalbott@proxytest:~$ ruby -rsocket -e 'p
Socket::getnameinfo(["AF_INET", 0, "www.noblepack.com"])'
["205.178.141.161", "0"]

Works like a charm. Thanks Guy (and everyone else that contributed)!


Nathaniel

<:((><


1 Answer

Jim Freeze

9/26/2003 4:11:00 PM

0


Sorry to barge in on your thread, but the topic reminded of
a question that you guys probably know the answer to:

How do I get the full name of the machine that I am on?
My current method involves ifconfig -a to get the IP and
nslookup to get the name.

Is there a ruby -e one liner to do this?

(Please forgive me if this is a stupid question.)
--
Jim Freeze
----------
"The Computer made me do it."