-
Notifications
You must be signed in to change notification settings - Fork 14
Not all versions of ping binary support float/double type numbers for the timeout flag #10
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
Comments
Can you call I just tried running the example code (very similar to yours) on my own ubuntu (20.10) machine and it seems to be working for me. |
ok with this
the output was: flutter: Running command: ping -O -n -W 2.0 -i 1.0 -t 255 -c 5 google.com edit: removing the decimals worked: ping -O -n -W 2 -i 1 -t 255 -c 5 google.com ping version |
You are awesome. I started typing this reply 3 times asking for additional info and just as I was about to send, you would edit your post with exactly the info I was about to ask for. Thanks for making my job easy! Anyway, this is a fascinating issue. I just booted an ubuntu 20.04 docker container and tested with the same ping version you appear to be using and I cannot reproduce the issue. See here:
Still, it's clear the issue does exist. So my options are:
Thoughts? |
I guess the problem has something to do with this: https://github.com./iputils/iputils/releases Incompatible changes Handling numeric options changed my $LC_NUMERIC is: declare -x LC_NUMERIC="pt_BR.UTF-8" I guess number 2 is the best option, or.... if the timeout flag fails with decimal, catch the exception and change it to int edit: oh and i had to remove the decimals from the -i and from -W |
I just pushed 6.0.0 which uses int instead of double. We'll see if anyone complains ;) If this change works for you, let me know or close the issue once you've tested. Thanks! |
Thanks a lot!!!! it works very well now =). If someone complains, well, you can try that thing, catching the exception and change to int. |
Now, would you venture in trying to make the web version working? there are some javascript codes that says they can ping. |
If you can link them to me, I am happy to take a look but last I checked, it seems browsers are not granted access to the underlying network utilities / layers |
Well i dont know how these works nor how npm works but these 3 seems the most promising some codes that i saw on stackoverflow just try to fake a ping downloading a img or something. |
Yeah all of these are for nodejs, which is a javascript runtime for servers. In other words, these are built for running directly on a machine, not in a browser on client side. They won't work if you try to import them in a webpage. As for the img method, I've seen stuff that tries to open a connection to another site as a means to "ping" from a webpage but most websites these days implement cors as a security measure and that would prevent this method from working reliably. Additionally, it wouldn't be able to access any local network resources due to browser security restrictions. So the only sites that would actually show as online are sites that are poorly secured and sites that are designed specifically to be accessible by other sites (for example, for the purpose of being embedded, like a cdn). May I ask what your use case for browser based ping is? Maybe I can help come up with a workaround. |
Ah, yeah that makes sense. Probably just catching a failed request is the best you can do in a browser. At least that I'm aware of. |
When i try yo run this on ubuntu 20.04
var ping = Ping(ip, count: 5);
ping.stream.listen((event) {
print(event);
});
the print(event); is never called
[✓] Flutter (Channel beta, 2.2.0-10.1.pre, on Linux, locale en_US.UTF-8)
• Flutter version 2.2.0-10.1.pre at /home/dante/a/flutter
• Framework revision 0941968447 (6 days ago), 2021-04-15 12:01:02 -0700
• Engine revision d2a2e93510
• Dart version 2.13.0 (build 2.13.0-211.6.beta)
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
The text was updated successfully, but these errors were encountered: