[英]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. 我有一个需要通过套接字连接到具有多个IP地址的远程计算机的应用程序。 Is there a way to turn the remote Hostname or IP a list of all the IPs that the system has?
有没有办法将远程主机名或IP变成系统具有的所有IP的列表?
Possibly (Hostname | Ip) => (RemoteMAC) => IPs? 可能(主机名| IP)=>(RemoteMAC)=> IP?
These will be windows server 2003/2008 machines. 这些将是Windows Server 2003/2008计算机。
require 'resolv-replace'
Resolv::DNS.new.each_address("oreilly.com") { |addr| puts addr }
produces: 产生:
208.201.239.101 208.201.239.101
208.201.239.100 208.201.239.100
http://codeidol.com/other/rubyckbk/Internet-Services/Performing-DNS-Queries/ http://codeidol.com/other/rubyckbk/Internet-Services/Performing-DNS-Queries/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.