Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,我有一个像 91.229.248.75:8085 这样的代理服务器,如果它工作我应该接收true,或者如果它不工作我应该接收false,我该如何使用 RoR?
true
false
你可以试试这个:
通过以下方式安装 net-ping gem
gem install net-ping
然后使用它来检查代理:
require 'net/ping' Net::Ping::TCP.new('91.229.248.75', 8085).ping
例如:
Net::Ping::TCP.new('www.google.com', 80).ping