From: Bill Kelly Date: 2009-05-14T19:20:19+09:00 Subject: Re: the question about getaddinfo From: "Qq Zz" > > I use getaddinfo to get A machine's hostname, > in B machine,the result is correct. > but in A machine,the result is just A machine's name > I use nslookup,the result is also correct. > who can tell me why in A machine,the result is wrong? I ran into something similar awhile back: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/13805 This is what I now use: ip = "208.77.188.166" result = Socket.getnameinfo( Socket.pack_sockaddr_in(0, ip) ) hostname = result ? result.first : ip Hope this helps, Bill