ARP Ping and ICMP in Ruby?

Discussion in 'Ruby' started by Ruby Rubyruby, Aug 10, 2007.

  1. 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/.
    Ruby Rubyruby, Aug 10, 2007
    #1
    1. Advertising

  2. 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/.
    Klodus Klodus, Aug 10, 2007
    #2
    1. Advertising

  3. Ruby Rubyruby

    Konrad Meyer Guest

    --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--
    Konrad Meyer, Aug 11, 2007
    #3
  4. On Aug 10, 6:02 pm, Konrad Meyer <> 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
    Gordon Thiesfeld, Aug 11, 2007
    #4
  5. On Aug 10, 8:42 am, 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 'net/ping'
    include Net

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

    if icmp.ping?
    # Successful
    else
    # Failed
    end

    gem install net-ping

    Regards,

    Dan
    Daniel Berger, Aug 11, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?iso-8859-2?Q?Pawe=B3_Ga=B3ecki?=

    [j2me] ICMP how to?

    =?iso-8859-2?Q?Pawe=B3_Ga=B3ecki?=, Jan 8, 2004, in forum: Java
    Replies:
    1
    Views:
    729
    Darryl L. Pierce
    Jan 9, 2004
  2. Mauro \Baba\ Mascia

    Ping and ARP on both Win and Linux in Python

    Mauro \Baba\ Mascia, Mar 13, 2008, in forum: Python
    Replies:
    1
    Views:
    1,143
    Rune Strand
    Mar 14, 2008
  3. Sagy Drucker

    icmp and raw sockets in python

    Sagy Drucker, Dec 13, 2011, in forum: Python
    Replies:
    1
    Views:
    353
    Martin P. Hellwig
    Dec 13, 2011
  4. Kevin Waters
    Replies:
    3
    Views:
    91
    Gyoung-Yoon Noh
    Jul 27, 2006
  5. Kevin Anderson

    Net-Ping ICMP issues (Windows)

    Kevin Anderson, Feb 11, 2009, in forum: Ruby
    Replies:
    0
    Views:
    447
    Kevin Anderson
    Feb 11, 2009
Loading...

Share This Page