如何仅使用标准套接字库在Ruby中实现ICMP ping? [英] How do I implement ICMP ping in Ruby using only the standard the socket library?
问题描述
应该可以使用Ruby套接字库发送和接收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.
我不想使用net-ping,icmp,ping以及所有其他这些因跨平台问题而失败,需要devkit和自定义构建的库,这些库在构建过程中失败,被忽略并具有长时间没有更新,和/或只是一般的越野车.
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.
任何人都没有关于如何完成此操作的良好文档?我要发送ICMP回显答复,而不是TCP或UDP数据包.
Does anyone have any good documentation on how to accomplish this? I want to send ICMP echo replies, not TCP or UDP packets.
推荐答案
在他的Net-ping项目中阅读Daniel Berger的代码,我就能知道他是如何做到的.
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
这篇关于如何仅使用标准套接字库在Ruby中实现ICMP ping?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!