Introduction:
In this article,i am going to explain about how to detect network or host availability using asp.net.
Main:
ASP.NET has a ping interface that supports synchronous and asynchronous
operations,
For ex,
System.Net.NetworkInformation.Ping ping =
new System.Net.NetworkInformation.Ping();
System.Net.NetworkInformation.PingReply reply = ping.Send(“yahoo.com”);
Console.WriteLine(“address: {0}”, reply.Address);
Console.WriteLine(“options: don’t fragment: {0}, TTL: {1}”,
reply.Options.DontFragment, reply.Options.Ttl);
Console.WriteLine(“rountrip: {0}ms”, reply.RoundtripTime);
Console.WriteLine(“status: {0}”, reply.Status);
The output is as follows:
address: 69.147.114.224
options: don’t fragment: False, TTL: 49
rountrip: 111ms
status: Success
System.Net.NetworkInformation.Ping ping = new System.Net.NetworkInformation.Ping(); System.Net.NetworkInformation.PingReply reply = ping.Send(“yahoo.com”); Console.WriteLine(“address: {0}”, reply.Address); Console.WriteLine(“options: don’t fragment: {0}, TTL: {1}”, reply.Options.DontFragment, reply.Options.Ttl); Console.WriteLine(“rountrip: {0}ms”, reply.RoundtripTime); Console.WriteLine(“status: {0}”, reply.Status); The output is as follows: address: 69.147.114.224 options: don’t fragment: False, TTL: 49 rountrip: 111ms status: Success |
Conclusion:
Hope this helps,
Happy Coding.
Wow this is a great resource.. I’m enjoying it.. good article
I’ve recently started a blog, the information you provide on this site has helped me tremendously. Thank you for all of your time & work.