# Net-Ping ICMP issues (Windows)

**URL:** <https://www.ruby-forum.com/t/net-ping-icmp-issues-windows/160110>\
**Category:** Ruby\
**Created:** [February 11, 2009, 9:39pm UTC](https://www.ruby-forum.com/t/net-ping-icmp-issues-windows/160110 "2009-02-11T21:39:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![b0rdslide](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a9a28c/32.png) [@b0rdslide](https://www.ruby-forum.com/u/b0rdslide)\
**Post date:** [February 11, 2009, 9:39pm UTC](https://www.ruby-forum.com/t/net-ping-icmp-issues-windows/160110/1 "2009-02-11T21:39:23Z")

</div>

Hello all -

I am running into a curious issue with Net-Ping on Windows (XP Pro SP2  
with administrator privileges). Attempting  
Net::Ping::ICMP.new(host).ping fails.

# Here’s the code (which executes flawlessly under OS X 10.5 using sudo):

require ‘rubygems’  
require ‘net/ping’  
include Net

hostlist = “192.168.1.1”

if Net::Ping::ICMP.new(hostlist).ping  
puts “alive”  
else  
puts “down”  
end

# Here’s the error message:

D:\Documents and Settings\220022671.USERSAPPLGE\>ruby icmpping.rb  
c:/ruby/lib/ruby/gems/1.8/gems/net-ping-1.2.3/lib/net/ping/icmp.rb:65:  
[BUG] rb\_  
sys\_fail(socket(2)) - errno == 0  
ruby 1.8.6 (2007-09-24) [i386-mswin32]

This application has requested the Runtime to terminate it in an unusual  
way.  
Please contact the application’s support team for more information.

D:\Documents and Settings\220022671.USERSAPPLGE\>

# Here are my currently installed Gems:

D:\Documents and Settings\220022671.USERSAPPLGE\>gem list --local

\*\*\* LOCAL GEMS \*\*\*

fxri (0.3.6)  
Graphical interface to the RI documentation, with search engine.

fxruby (1.6.12)  
FXRuby is the Ruby binding to the FOX GUI toolkit.

hoe (1.8.3)  
Hoe is a simple rake/rubygems helper for project Rakefiles

hpricot (0.6)  
a swift, liberal HTML parser with a fantastic library

log4r (1.0.5)  
Log4r is a comprehensive and flexible logging library for Ruby.

net-ping (1.2.3)  
A ping interface for Ruby.

rake (0.8.3, 0.7.3)  
Ruby based make-like utility.

rubyforge (1.0.2)  
A script which automates a limited set of rubyforge operations

sources (0.0.1)  
This package provides download sources for remote gem installation

test-unit (2.0.2)  
Test::Unit 2.x - Improved version of Test::Unit bundled in Ruby  
1.8.x

win32-api (1.3.0, 1.0.4)  
A superior replacement for Win32API

win32-clipboard (0.4.3)  
A package for interacting with the Windows clipboard

win32-dir (0.3.2)  
Extra constants and methods for the Dir class on Windows.

win32-eventlog (0.4.6)  
Interface for the MS Windows Event Log.

win32-file (0.5.4)  
Extra or redefined methods for the File class on Windows.

win32-file-stat (1.2.7)  
A File::Stat class tailored to MS Windows

win32-open3 (0.2.7)  
Provides an Open3.popen3 implementation for MS Windows

win32-process (0.5.3)  
Adds fork, wait, wait2, waitpid, waitpid2 and a special kill method

win32-sapi (0.1.4)  
An interface to the MS SAPI (Sound API) library.

win32-sound (0.4.1)  
A library for playing with sound on MS Windows.

windows-api (0.3.0, 0.2.0)  
An easier way to create methods using Win32API

windows-pr (1.0.1, 0.7.2)  
Windows functions and constants bundled via Win32::API

Seeing as how the application works in OS X and not in Windows it leads  
me to think there’s an issue with the Ping::ICMP implementation on the  
Windows platform specifically. Ping::TCP works perfectly.

Thanks

Kevin Anderson
