Code backup
This commit is contained in:
2026-05-10 16:59:01 +02:00
commit 368d6fafea
796 changed files with 315310 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
TextToBeWritten = "<div>Pinging... </div>";
string ipBase = "172.16.94.";
for (int i = 1; i < 100; i++)
{
string ip = ipBase + i.ToString();
Ping p = new Ping();
var pingReply = p.Send(ip, 100);
if (pingReply.Status != IPStatus.Success)
TextToBeWritten += "<div><div class=\"host-offline\">Offline</div>" + ip + "</div>";
else
{
//Machine is alive
TextToBeWritten += "<div><div class=\"host-online\">Online</div>" + ip + "</div>";
IPAddress hostIPAddress = IPAddress.Parse(ip);
TextToBeWritten += "<div>";
try
{
IPHostEntry hostInfo = Dns.GetHostByAddress(hostIPAddress);
IPAddress[] address = hostInfo.AddressList;
String[] alias = hostInfo.Aliases;
TextToBeWritten += "Host: " + hostInfo.HostName;
}
catch (Exception e)
{
TextToBeWritten += "DNS Resolution Error: " + e.Message;
}
TextToBeWritten += "</div>";
}
}