Wednesday, 2 September 2015

How to ping ip address or by url in c#

 static void Main(string[] args)
        {
           string url = "http://stackoverflow.com/";
            Ping p = new Ping();
            PingReply p1 = p.Send("IP address or site url", 3000);
           //3000 -> it is time out time
            if (p1.Status == IPStatus.Success)
            {
                Console.WriteLine("working fine");
            }
            Console.ReadLine();
        }

No comments:

Post a Comment