mirror of
https://github.com/jwetzell/qController.git
synced 2026-08-03 22:47:54 +00:00
34 lines
891 B
C#
34 lines
891 B
C#
//IP Address verification
|
|
//IMPLEMENT A ISREACHABLE METHOD TO BE ABLE TO DISPLAY ONLINE QINSTANCES
|
|
using System.Net;
|
|
|
|
namespace qController.Helpers
|
|
{
|
|
public class IPHelper
|
|
{
|
|
public IPHelper()
|
|
{
|
|
}
|
|
|
|
public static bool IsValidAddress(string ipString){
|
|
return (ipString.Split('.').Length - 1) == 3 && IPAddress.TryParse(ipString, out _);
|
|
}
|
|
|
|
public static bool IsReachable(string ipString)
|
|
{
|
|
/*try
|
|
{
|
|
IPAddress instanceIP = IPAddress.Parse(address);
|
|
Ping p = new System.Net.NetworkInformation.Ping();
|
|
PingReply reply = p.Send(instanceIP);
|
|
return reply.Status == IPStatus.Success ? true : false;
|
|
}
|
|
catch
|
|
{
|
|
return false;
|
|
}*/
|
|
return true;
|
|
}
|
|
}
|
|
}
|