Türkçe   |   English
Calendar
Categories
Archive
Links
Blogroll
Files

Pinging With .Net - 19.02.2009

You can easily ping an address with your .Net applications via a class came by .Net 2.0. I am sharing the code snippet with you which can be used for discovering whether a website is down or not.

C#

            System.Net.NetworkInformation.Ping png = new System.Net.NetworkInformation.Ping();
             try
 
            {
                 PingReply rply = png.Send("www.tameroz.com");
                 Console.Write(rply.RoundtripTime.ToString());
                 Console.ReadLine();
             }
             catch (Exception)
             {
                 Console.Write("Ping Error");
                 Console.ReadLine();
 
            }

 

VB.Net

 

        Dim png As New System.Net.NetworkInformation.Ping()
        Try
            Dim rply As PingReply = png.Send("www.tameroz.com")
            Console.Write(rply.RoundtripTime.ToString())
            Console.ReadLine()
        Catch generatedExceptionName As Exception
            Console.Write("Ping Error")
            Console.ReadLine()
        End Try

Clues,Codes

Add Comment
First Name Last Name
Web Site
E-Mail
Comment
Security Picture

Photos

The entrance of Microsoft Egypt
Show All
Me in MSDN Forums
-   Answered the question Close some open windows by name in the Visual C# General forum
-   Answered the question Close some open windows by name in the Visual C# General forum
-   Answered the question Datagridview Click Event in C#.net in the Visual C# General forum
-   Contributed a proposed answer to the question Close some open windows by name in the Visual C# General forum
-   Replied to the question Datagridview Click Event in C#.net in the Visual C# General forum
-   Replied to the question Close some open windows by name in the Visual C# General forum
-   Contributed a helpful post (total votes:2) to the forums thread Array of events? in the Visual C# General forum
-   Answered the question Displaying random images from resources in the project in the Visual C# Language forum
-   Contributed a helpful post (total votes:1) to the forums thread sorted dictionary (Can i get key from value) in the Visual C# General forum
-   Contributed a proposed answer to the question Non-existing Argument in format string in the Visual C# General forum
Entries
News
Articles