I think this is a simple problem. I have an IP address and I want to ping it and get its duration. However, in UWP there is no Ping
class.
How do I ping an IP without this class? Should I connect to a specific port instead?
Add the System.Net.Ping NuGet package to your project
try to ping Port 80. Normally thats the port you have to use if you are pinging a website.
try this:
HostName host = new HostName("www.google.com");
var eps = await DatagramSocket.GetEndpointPairsAsync(host , "80");
if(eps.Count >= 1)
{
return true;
}
else
{
return false;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With