6

只是测试 IP 地址存活状态,是否有好轮子?(os.system 使用系统的 ping 不算)

 3 years ago
source link: https://www.v2ex.com/t/778472
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  Python

只是测试 IP 地址存活状态,是否有好轮子?(os.system 使用系统的 ping 不算)

  uti6770werty · 1 天前 · 959 次点击

搜索引擎介绍的博客,多数是 os.system 使用系统 ping 来判断去解决的,不是很合意,
再往一层,技巧就一下子深入到 sock 接口上生成 icmp 包去 sned 和 recive 并且设计到异步处理(全环节手工),有违使用 python 的初衷(其实不好抄代码到现在的代码里,要改很多逻辑),粗略看了一下 python 生态,似乎没有在 OSI 二层,三层或者四层专门去折腾 ARP,ICMP,IGMP,TTL 这些事情的库?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK