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

时光毁灭记忆、已成空白 提交于 2019-12-10 03:19:19

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/8934453/how-do-i-implement-icmp-ping-in-ruby-using-only-the-standard-the-socket-library

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!