First commit

This commit is contained in:
amdnaji 2024-03-17 20:50:31 +00:00
parent 6b2ff55f45
commit b6db5eb059
3 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -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

46
Manarah.App/Program.cs Normal file
View File

@ -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();
}
}
}