ruby ping for 1.9.1

前端 未结 4 1042
萌比男神i
萌比男神i 2021-02-03 10:37

I want to ping a site in my ruby code and saw that net-ping was a nice library to do this with. Unfortunately, when I tried to gem install net-ping I got the following error:

4条回答
  •  北荒
    北荒 (楼主)
    2021-02-03 10:47

    For windows follow these instructions:

    download djberg96-net-ping-net-ping-1.5.3-0-g9252076.zip from github.com/djberg96/net-ping
    unzip, cd in the folder
    gem build net-ping.gemspec
    gem install net-ping-1.5.3-universal-mingw32.gem
    gem install win32-security
    

    to use it:

    require 'net/ping'
    p Net::Ping::TCP.new('www.google.com', 'http').ping?
    p Net::Ping::TCP.new('foo.bar.baz').ping?
    

提交回复
热议问题