Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > ARP Ping and ICMP in Ruby?

Reply
Thread Tools

ARP Ping and ICMP in Ruby?

 
 
Ruby Rubyruby
Guest
Posts: n/a
 
      08-10-2007
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?
--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Klodus Klodus
Guest
Posts: n/a
 
      08-10-2007
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?


require 'ping'

Ping.pingecho('example.com')

or

system('ping -c1 www.example.com')

--
Posted via http://www.ruby-forum.com/.

 
Reply With Quote
 
 
 
 
Konrad Meyer
Guest
Posts: n/a
 
      08-10-2007
--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 <(E-Mail Removed)> 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)

iD8DBQBGvO6UCHB0oCiR2cwRApTYAJ9vgCas3q2oE3hLiI0Efk 8wEeCmHwCgua9h
MVkR6DS9m47oB53mCkSqrUg=
=ffS7
-----END PGP SIGNATURE-----

--nextPart2506670.Lt7uc5MZgO--

 
Reply With Quote
 
Gordon Thiesfeld
Guest
Posts: n/a
 
      08-10-2007
On Aug 10, 6:02 pm, Konrad Meyer <(E-Mail Removed)> wrote:
> 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?



http://raa.ruby-lang.org/project/icmpping/

hope it helps

Gordon

 
Reply With Quote
 
Daniel Berger
Guest
Posts: n/a
 
      08-11-2007


On Aug 10, 8:42 am, Ruby Rubyruby <(E-Mail Removed)> 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?


require 'net/ping'
include Net

icmp = Ping::ICMP.new('foo.com')

if icmp.ping?
# Successful
else
# Failed
end

gem install net-ping

Regards,

Dan


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arp or Proxy Arp Darren Green Cisco 0 02-20-2009 09:38 PM
Ping and ARP on both Win and Linux in Python Mauro \Baba\ Mascia Python 1 03-14-2008 09:21 PM
Pings and PIX messages 302020: Built ICMP - 302021: Teardown ICMP Lots of them.... Scott Townsend Cisco 2 05-04-2006 02:31 PM
ICMP, the minimum to ping the internet but not the pix to pinged Alexandre Durbuy Cisco 2 06-08-2005 11:29 AM



Advertisments