From c6b5f5053ae5eff08131877250b9dedf31f17297 Mon Sep 17 00:00:00 2001 From: shohan-pherones Date: Fri, 7 Apr 2023 17:51:16 +0600 Subject: [PATCH] ping watcher added --- ping.config.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 ping.config.cs diff --git a/ping.config.cs b/ping.config.cs new file mode 100644 index 0000000..1f64e4f --- /dev/null +++ b/ping.config.cs @@ -0,0 +1,24 @@ +using System; +using System.Net.NetworkInformation; + +class Program +{ + static void Main(string[] args) + { + string host = "http://locahost:3000"; // replace with the hostname or IP address to ping + + Ping ping = new Ping(); + PingReply reply = ping.Send(host); + + if (reply.Status == IPStatus.Success) + { + Console.WriteLine("Ping to {0} successful. Time: {1}ms", host, reply.RoundtripTime); + } + else + { + Console.WriteLine("Ping to {0} failed. Status: {1}", host, reply.Status); + } + + Console.ReadKey(); + } +}