Revisione test pingServer
This commit is contained in:
+22
-14
@@ -16,6 +16,11 @@ namespace IOB_WIN
|
||||
{
|
||||
#region variabili ed oggetti base
|
||||
|
||||
/// <summary>
|
||||
/// TImeout x ping al server
|
||||
/// </summary>
|
||||
protected int pingServerMsTimeout = utils.CRI("pingMsTimeout");
|
||||
|
||||
/// <summary>
|
||||
/// Indicazione VETO invio a server sino alla data-ora indicata
|
||||
/// </summary>
|
||||
@@ -1746,19 +1751,21 @@ namespace IOB_WIN
|
||||
/// test ping all'indirizzo impostato nei parametri
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private IPStatus testPingServer()
|
||||
private IPStatus testPingServer
|
||||
{
|
||||
IPStatus answ = IPStatus.Unknown; ;
|
||||
IPAddress address;
|
||||
PingReply reply;
|
||||
Ping pingSender = new Ping();
|
||||
address = IPAddress.Loopback;
|
||||
string ipAdrr = cIobConf.serverData.MPIP.Replace("http://", "").Replace("https://", "");
|
||||
IPAddress.TryParse(ipAdrr, out address);
|
||||
int pingMsTimeout = utils.CRI("pingMsTimeout");
|
||||
reply = pingSender.Send(address, pingMsTimeout);
|
||||
answ = reply.Status;
|
||||
return answ;
|
||||
get
|
||||
{
|
||||
IPStatus answ = IPStatus.Unknown; ;
|
||||
IPAddress address;
|
||||
PingReply reply;
|
||||
Ping pingSender = new Ping();
|
||||
address = IPAddress.Loopback;
|
||||
string ipAdrr = cIobConf.serverData.MPIP.Replace("http://", "").Replace("https://", "");
|
||||
IPAddress.TryParse(ipAdrr, out address);
|
||||
reply = pingSender.Send(address, pingServerMsTimeout);
|
||||
answ = reply.Status;
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Verifica se il server sia ALIVE (tramite PING)
|
||||
@@ -1777,14 +1784,15 @@ namespace IOB_WIN
|
||||
}
|
||||
else
|
||||
{
|
||||
IPStatus pingStatus = testPingServer();
|
||||
IPStatus pingStatus = testPingServer;
|
||||
// se passa il ping faccio il resto...
|
||||
if (pingStatus == IPStatus.Success)
|
||||
{
|
||||
try
|
||||
{
|
||||
// chiamo URL, se restituisce "OK" è alive!
|
||||
answ = (callUrl(urlAlive) == "OK");
|
||||
string callResp = callUrl(urlAlive);
|
||||
answ = (callResp == "OK");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user