Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I implement ICMP ping in Ruby using only the standard the socket library?

Tags:

ruby

ping

icmp

It should be possible send and receive ICMP packets using the Ruby socket library but I do not see any good documentation on this.

I do not want to use net-ping, icmp, ping, and all of these other libraries that either fail because of cross-platform issues, require devkit and custom building, which fail during the build process, are neglected and have not been updated for a lengthy time, and/or are just in general buggy.

Does anyone have any good documentation on how to accomplish this? I want to send ICMP echo replies, not TCP or UDP packets.

like image 432
Beaon Avatar asked Jan 19 '12 22:01

Beaon


1 Answers

Reading Daniel Berger's code on his Net-ping project I was able to see how he did it.

http://rubygems.org/gems/net-ping

like image 177
Beaon Avatar answered Oct 12 '22 12:10

Beaon