-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Slow Ping Class #102445
Comments
Tagging subscribers to this area: @dotnet/ncl |
It sounds like |
@huoyaoyuan as I mention in the Question itself, I have tested and confirmed that it doesn't respect the |
That seems to be problem with underlying Windows API. We pass timeout to it and it works as expected for larger value (1s+) but it is not that precise for vary short timouts runtime/src/libraries/System.Net.Ping/src/System/Net/NetworkInformation/Ping.Windows.cs Lines 164 to 183 in 24562bc
The async option may be best IMHO as one should not need to wait for the response. But it also allocates wait handle and does what The easy workaround could probably be |
Description
Describe the bug
I want to ping about 180 IPs that most of them, say about 175 of them are disconnected from local network and respond timeout. I know about this and I set timeout in
Ping
Command to 10ms so It shouldn't take a lot of time! BUT It takes 110 seconds to complete that is about 600ms. I testedasync/await
and without that, I usedforeach
andawait Task.WhenAll
but non of them seem to work, It is really weird. when I have them connected, I can say that this process takes about 1 sec to complete! I assume that thistimeout
setting inPing
command is just Ridiculous and doesn't do a thing. If this works, assume that all the IPs are dead, It should take 1.8 seconds to complete.one of my codes:
the other one:
and tested this one either:
PingReply reply = await new Ping().SendPingAsync(item.DevIPWIFI,10); // And this one with await
After I saw the delay, I tested the
timeout
specially to see how it react, but it doesn't react like it supposed to do.I have to mention that if the devices are connected and have ping, all 180 IPs will respond in less than a second!
Reproduction Steps
make a list of 180 IPs that are disconnected and respond with timeout. Use
SendPingAsync()
orSend()
Method to get respond.Expected behavior
timeout as I expected.
Actual behavior
won't timeout as I mentioned. no matter if you put 1ms or 100ms
Regression?
No response
Known Workarounds
No response
Configuration
Other information
I asked SDK team and stackoverflow, but they send me to dotnet runtime team.
The text was updated successfully, but these errors were encountered: