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

confusing "Packet Loss" result #231

Open
NatUni opened this issue Sep 5, 2024 · 3 comments
Open

confusing "Packet Loss" result #231

NatUni opened this issue Sep 5, 2024 · 3 comments

Comments

@NatUni
Copy link

NatUni commented Sep 5, 2024

i get:

✓ Packet Loss: N/A

does that mean no packet loss, or "none", because, i dont know about you but, packet loss is definitely "applicable" in my life. LOL

or, does that output mean that the Packet Loss Analyzer doesn't work on my platform? (FreeBSD 13.3/amd64, Go 1.22) if that were the case then i'd hope to see some output besides "✓ Packet Loss Analyzer: Running in background (<= 30 Secs)" and its all green checkmarks down the line

@r3inbowari
Copy link
Collaborator

r3inbowari commented Sep 5, 2024

Hi, @NatUni, I think there are two possible reasons for N/A:

  1. The provider server firewall actively rejected/dropped TCP/UDP packets.
  2. Your host does not support (but this is almost impossible) or your firewall rejected/dropped it.

However, in the process of developing this feature, I found that some servers did not count the received udp datagrams (the tcp pipeline behaved normally). I don't know why, but this is the main reason for N/A. The situation you encountered also exists in the official speedtest... I suggest you try another server.

✓ Packet Loss: N/A

Do you want the line to be displayed as × Packet Loss: N/A?

@NatUni
Copy link
Author

NatUni commented Sep 5, 2024

thank you for your very prompt response!

you answered my question satisfactorily. it's up to you if you think it's worth modifying the user interface. an "x" seems drastic, maybe a "?"

as far as im concerned, your package is good as is, so feel free to close this issue.

i bring you additional information you may do with what you will: against my better judgement i tried running as root (just a hunch, knowing ping requires setuid bit in order to be widely used on my system, FreeBSD 13.3) and it consistently (5 runs) reports a packet loss between 2 and 5 percent. 5 runs from my typical user account all reported it's "N/A". all ten of these runs chose automatically the same server, #60915 (which happens to be with my ISP and 19th in the (-l)ist of 20 nearby servers wihle also the lowest ping listed). then however, when i tried 5 other servers at random, (1 was also at my ISP, 4 not) and all of those returned "N/A" whether i used root or bob

@r3inbowari
Copy link
Collaborator

r3inbowari commented Sep 5, 2024

It seems that you always get N/A in a non-root environment.
Have you tested this example without root? https://github.com/showwin/speedtest-go/blob/master/example/packet_loss/main.go This method can avoid N/A to the greatest extent by introducing more servers.

Or have you tried using -m in speedtest-go, it will enable multiple server targets as packet loss test targets, and calculate their weighted average packet loss rate (Sorry this feature is not enabled in 1.7.x, but you can use RunMulti or RunMultiWithContext as shown in the example to achieve the same effect).

// use mixed PacketLoss
mixed, err := analyzer.RunMulti(serverList.Hosts())
checkError(err)
fmt.Printf("Mixed packets lossed: %.2f%%\n", mixed.LossPercent())
fmt.Printf("Mixed packets lossed: %.2f\n", mixed.Loss())
fmt.Printf("Mixed packets lossed: %s\n", mixed)

// Output
> Mixed packets lossed: 1.40%
> Mixed packets lossed: 0.01
> Mixed packets lossed: Packet Loss: 1.40% (Sent: 2116/Dup: 0/Max: 2145)

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

No branches or pull requests

2 participants