简体   繁体   中英

How to get a list of IPs for a remote computer in Ruby

I have a app that needs to connect over a socket to a remote computer that now has multiple IP addresses. Is there a way to turn the remote Hostname or IP a list of all the IPs that the system has?

Possibly (Hostname | Ip) => (RemoteMAC) => IPs?

These will be windows server 2003/2008 machines.

require 'resolv-replace'
Resolv::DNS.new.each_address("oreilly.com") { |addr| puts addr }

produces:

208.201.239.101
208.201.239.100

http://codeidol.com/other/rubyckbk/Internet-Services/Performing-DNS-Queries/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM