From: Konrad Meyer Date: 2007-08-11T08:02:48+09:00 Subject: Re: ARP Ping and ICMP in Ruby? --nextPart2506670.Lt7uc5MZgO Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Friday 10 August 2007 03:20:19 pm Klodus Klodus wrote: > Ruby Rubyruby wrote: > > What would I have to do in order to be able to send an ARP Ping or a > > regular ICMP_ECHO_REQUEST in Ruby? Is it possible? >=20 > require 'ping' >=20 > Ping.pingecho('example.com') Unfortunately, this isn't a 'ICMP_ECHO_REQUEST', it's an attempt to connect to the remote machine on the 'echo' port. If the connection is refused or allowed, pingecho() returns true. If it times out, or otherwise errors, it returns false. Either way, it's not ICMP if you *need* ICMP. > or >=20 > system('ping -c1 www.example.com') Shelling out to a ping command is probably a bad idea for portability reasons. If a TCP connection test works for you then go with the stdlib Ping library. If it doesn't, you might look into RubyInline or writing a simple C extension for basic ICMP requests. Cheers! =2D-=20 Konrad Meyer http://konrad.sobertillnoon.com/ --nextPart2506670.Lt7uc5MZgO Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQBGvO6UCHB0oCiR2cwRApTYAJ9vgCas3q2oE3hLiI0Efk8wEeCmHwCgua9h MVkR6DS9m47oB53mCkSqrUg= =ffS7 -----END PGP SIGNATURE----- --nextPart2506670.Lt7uc5MZgO--