diff --git a/IOB-WIN-NEXT/IobGeneric.cs b/IOB-WIN-NEXT/IobGeneric.cs index 5fe47712..84f1c7db 100644 --- a/IOB-WIN-NEXT/IobGeneric.cs +++ b/IOB-WIN-NEXT/IobGeneric.cs @@ -555,33 +555,37 @@ namespace IOB_WIN_NEXT // se != null --> uso address... if (address != null) { - pingTOut = rand.Next(100, 200); - reply = pingSender.Send(address, pingServerMsTimeout + pingTOut); + pingTOut = rand.Next(200, 400); + reply = pingSender.Send(address, pingTOut); } else { - pingTOut = rand.Next(200, 400); - reply = pingSender.Send(cIobConf.cncIpAddr, pingServerMsTimeout + pingTOut); + pingTOut = rand.Next(300, 600); + reply = pingSender.Send(cIobConf.cncIpAddr, pingTOut); } } catch (Exception exc) { - pingTOut = rand.Next(50, 100); - reply = pingSender.Send(IPAddress.Loopback, pingServerMsTimeout + pingTOut); + pingTOut = rand.Next(100, 200); + reply = pingSender.Send(IPAddress.Loopback, pingTOut); lgError($"ping to loopback addres per eccezione:{Environment.NewLine}{exc}"); } // se ho timeout riprovo... while (reply.Status != IPStatus.Success && numRetry < maxRetry) { - lgInfo($"Server Ping KO | reply: {reply.Status} --> retry"); - Thread.Sleep(rand.Next(300, 600)); - reply = pingSender.Send(address, pingServerMsTimeout * numRetry / 2 + pingTOut); + Thread.Sleep(rand.Next(50, 200)); + pingTOut = pingServerMsTimeout * numRetry / 2; + reply = pingSender.Send(address, pingTOut); numRetry++; if (reply.Status == IPStatus.Success) { lgInfo("Server PING OK!"); break; } + else + { + lgInfo($"Server Ping KO | reply: {reply.Status} --> retry | TimeOut: {pingTOut}"); + } } } answ = reply.Status;