Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update icmp.c #376

Closed
wants to merge 2 commits into from
Closed

Update icmp.c #376

wants to merge 2 commits into from

Conversation

Kelephant
Copy link

libhv是个很棒的库。但是最近使用其ping时出现了一些问题

  1. ping 后程序提前退出
  2. ping 一个未知的ip,程序也能收到ping包

解决方案
综合比较了busybox的ping程序,以及他们的ping流程,做如下改动

  1. 把recvfrom改为recv(我不知道为何,改完之后,无效包就少了,我再继续查下资料)
  2. 发送ping包后,如果1s内未收到有效包,则重新回到recv

发送ping包后,发送ping包后,如果1s内收到未收到有效包,则重新回到recv
@Kelephant
Copy link
Author

@ithewei 麻烦看下更新一下这个pr

@ithewei
Copy link
Owner

ithewei commented May 16, 2023

ping是使用raw socket发送icmp包,接受回复应该是使用recvfrom,不太清楚你使用recv的原因?

@Kelephant Kelephant closed this May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants