[Win32utils-devel] ICMP pings on 1.9

Heesob Park phasis at gmail.com
Tue Feb 28 16:08:23 UTC 2012


Hi,

2012/2/28 Daniel Berger <djberg96 at gmail.com>

>
>
> > -----Original Message-----
> > From: win32utils-devel-bounces at rubyforge.org [mailto:win32utils-devel-
> > bounces at rubyforge.org] On Behalf Of Heesob Park
> > Sent: Sunday, February 26, 2012 2:33 AM
> > To: Development and ideas for win32utils projects
> > Subject: Re: [Win32utils-devel] ICMP pings on 1.9
> >
> > Hi,
> >
> >
> > 2012/2/26 Daniel Berger <djberg96 at gmail.com>
> >
> >
> >       Hi,
> >
> >       While making some tweaks to the net-ping library, I noticed that
> > I started
> >       getting test failures with 1.9.x on Vista for ICMP pings. A
> > simple program
> >       should demonstrate:
> >
> >       require 'net/ping'
> >       npi = Net::Ping::ICMP.new('localhost')
> >       p npi.ping?
> >
> >       icmp.rb:109:in `send': An address incompatible with the requested
> > protocol
> >       was used. - send(2) (Errno::EAFNOSUPPORT)
> >              from icmp.rb:109:in `ping'
> >              from icmp.rb:184:in `<main>'
> >
> >       Where line 109 (using the latest git repo) is:
> >
> >       socket.send(msg, 0, saddr)
> >
> >       I don't see this failure using 1.8, or even 1.9 on Unix
> > platforms. Any
> >       ideas?
> >
> >
> >
> >
> > On Windows Vista (and Windows 7), the host "localhost"  translated into
> > "::1" IPv6 Loopback address instead of "127.0.0.1" IPv4 Loopback
> > address.
> > You can check it with "ping localhost" in command prompt.
> >
> > You must use "127.0.0.1" instead of "localhost" for this test case.
> >
> > Refer to http://stackoverflow.com/questions/2370388/socketexception-
> > address-incompatible-with-requested-protocol
>
> Thank you for the information. However, I'm confused why the tests pass on
> Vista with 1.8.7 then. I would think they would fail regardless of which
> version of Ruby I am using.
>
> My apologies if I have misunderstood.
>
>
Ruby 1.8.7 uses it's own getaddrinfo function defined in getaddrinfo.c
But Ruby 1.9.3 uses Windows native getaddrinfo function.

Thus Ruby 1.8.7 translate "localhost" into "127.0.0.1" regardless of OS.

Regards,

Park Heesob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/win32utils-devel/attachments/20120229/a27155b7/attachment.html>


More information about the win32utils-devel mailing list