Question

What replacements are available for pinging an ip address in Ruby? The stdlib "ping" library seems to be pretty limited in functionality. I'm not interested in rolling my own code here. Are there good gems available? Should I just suck it up and live with it?

(I'm coding in Ruby 1.8.6 on Linux)

Was it helpful?

Solution

net-ping is worth a look. It allows for TCP pings (like the standard ruby ping) but also UDP, HTTP, and ICMP pings. An ICMP ping requires root privileges but the others do not.

OTHER TIPS

To implement ping, you need to create a raw socket, which is restricted to root. So it isn't really possible to implement ping as a library, unless you know you will run as root. If the latter is acceptable, take a look at the icmpping library.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top