From b6db5eb059e4e99be300c1e0335868c71639cbfb Mon Sep 17 00:00:00 2001 From: amdnaji Date: Sun, 17 Mar 2024 20:50:31 +0000 Subject: [PATCH] First commit --- Manarah.App/Manarah.App.csproj | 10 ++++++++ Manarah.App/Manarah.App.sln | 25 ++++++++++++++++++ Manarah.App/Program.cs | 46 ++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 Manarah.App/Manarah.App.csproj create mode 100644 Manarah.App/Manarah.App.sln create mode 100644 Manarah.App/Program.cs diff --git a/Manarah.App/Manarah.App.csproj b/Manarah.App/Manarah.App.csproj new file mode 100644 index 0000000..2150e37 --- /dev/null +++ b/Manarah.App/Manarah.App.csproj @@ -0,0 +1,10 @@ + + + + Exe + net8.0 + enable + enable + + + diff --git a/Manarah.App/Manarah.App.sln b/Manarah.App/Manarah.App.sln new file mode 100644 index 0000000..f237847 --- /dev/null +++ b/Manarah.App/Manarah.App.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.8.34525.116 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Manarah.App", "Manarah.App.csproj", "{1430554B-EEE9-447C-B0F2-3947A3DF1B8C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {1430554B-EEE9-447C-B0F2-3947A3DF1B8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1430554B-EEE9-447C-B0F2-3947A3DF1B8C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1430554B-EEE9-447C-B0F2-3947A3DF1B8C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1430554B-EEE9-447C-B0F2-3947A3DF1B8C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A3C4374E-F704-4D7C-88D0-BBEB231C39FC} + EndGlobalSection +EndGlobal diff --git a/Manarah.App/Program.cs b/Manarah.App/Program.cs new file mode 100644 index 0000000..57d4d53 --- /dev/null +++ b/Manarah.App/Program.cs @@ -0,0 +1,46 @@ +using System; +using System.Net.NetworkInformation; + +namespace Manarah.App +{ + class Program + { + static void Main(string[] args) + { + string server1 = "172.25.0.1"; // Replace with actual server name or IP address + string server2 = "172.25.0.2"; // Replace with actual server name or IP address + string server3 = "104.21.6.135"; // Replace with actual server name or IP address + + Console.WriteLine("Checking server status..."); + + foreach (string server in new[] { server1, server2,server3 }) + { + + try + { + + Ping ping = new Ping(); + PingReply reply = ping.Send(server, 500); // Timeout after 500ms + + if (reply.Status == IPStatus.Success) + { + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine($"{server} is up and running! Response time: {reply.RoundtripTime}ms"); + } + else + { + Console.ForegroundColor = ConsoleColor.Red; + Console.WriteLine($"{server} is not responding."); + } + } + catch (PingException ex) + { + Console.WriteLine($"Error checking {server}: {ex.Message}"); + } + } + Console.ResetColor(); + Console.WriteLine("Press any key to exit."); + Console.ReadKey(); + } + } +} \ No newline at end of file