[Win32utils-devel] ICMP pings on 1.9

Heesob Park phasis at gmail.com
Sun Feb 26 09:32:51 UTC 2012


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

Regards,

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


More information about the win32utils-devel mailing list