vers 306: aggiunto controllo SE pingare, solo OPEN!!!

This commit is contained in:
Samuele E. Locatelli
2018-11-23 17:08:46 +01:00
parent 56e00c5a17
commit 4c6fcfed75
2 changed files with 24 additions and 12 deletions
+23 -11
View File
@@ -244,7 +244,7 @@ namespace IOB_WIN
// è little endian (NON serve conversione)
hasBigEndian = false;
lgInfo("Start init Adapter OSAI all'IP/NOME{0}:{1} per IOB {2}", IOBConf.cncIpAddr, IOBConf.cncPort, IOBConf.codIOB);
lgInfo("Start init Adapter OSAI, tipo all'IP/NOME {0}, variante {1} per IOB {2}", IOBConf.cncIpAddr, IOBConf.tipoIob, IOBConf.codIOB);
// Creo oggetto x gestione connessione/comunicazione NC: secondo il tipo creo CNDEX o OPEN
parentForm.commPlcActive = true;
@@ -438,15 +438,24 @@ namespace IOB_WIN
{
lgInfo("ConnKO - tryConnect");
}
// in primis salvo data ping...
lastPING = DateTime.Now;
// ora PING!!!
// PING SOLO x OPEN!!!
bool needPing = (currIobConf.tipoIob == tipoAdapter.OSAI_OPEN);
bool pingOk = false;
Ping pingSender = new Ping();
IPAddress address = IPAddress.Loopback;
IPAddress.TryParse(currIobConf.cncIpAddr, out address);
PingReply reply = pingSender.Send(address, 100);
PingReply reply = pingSender.Send("127.0.0.1", 100);
// se serve PING...
if (needPing)
{
// in primis salvo data ping...
lastPING = DateTime.Now;
// ora PING!!!
IPAddress address = IPAddress.Loopback;
IPAddress.TryParse(currIobConf.cncIpAddr, out address);
reply = pingSender.Send(address, 100);
pingOk = reply.Status == IPStatus.Success;
}
// se passa il ping faccio il resto...
if (reply.Status == IPStatus.Success)
if (pingOk || !needPing)
{
string szStatusConnection = "";
try
@@ -458,7 +467,7 @@ namespace IOB_WIN
{
// log errore!
lgInfo("Impossibile effettuare apertura sessione: " + OSAI_ref.ErrMsg);
}
}
parentForm.commPlcActive = false;
lgInfo("szStatusConnection: " + szStatusConnection);
connectionOk = true;
@@ -494,9 +503,12 @@ namespace IOB_WIN
{
// loggo no risposta ping ...
connectionOk = false;
if (verboseLog || periodicLog)
if (needPing)
{
lgInfo(string.Format("Attenzione: controllo PING fallito per IP {0} - {1}", currIobConf.cncIpAddr, reply.Status));
if (verboseLog || periodicLog)
{
lgInfo(string.Format("Attenzione: controllo PING fallito per IP {0} - {1}", currIobConf.cncIpAddr, reply.Status));
}
}
}
}
Vendored
+1 -1
View File
@@ -16,7 +16,7 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=305']) {
withEnv(['NEXT_BUILD_NUMBER=306']) {
// env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '1.18.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO-IOB-WIN'