Buongiorno,
dato che ho trovato la soluzione, la posto nel caso qualcuno abbia bisogno:
basta creare questa Sub e richiamarla dove ci serve, io l'ho richiamata all'interno di un Timer
Come parametri gli passeremo l'Ip da pingare, il timeout e i tentativi che dovrà fare.
Farà tanti tentativi quanti ne faremo fare e alla fine farà la media dei risultati.
Se come media otterrà un risultato > 0.7 tentativi con successo, allora risponderà "Destination Avaible"
Codice preso e modificato da questa conversazione:codice:Private Async Sub doPing(ipHost As String, timeout As Integer, Optional tentativi As Integer = 1) Dim totalPingsToTry As Integer = tentativi Dim successCount As Integer Me.UseWaitCursor = True Using myPinger As New Ping For counter As Integer = 1 To totalPingsToTry Try Dim myReply As PingReply = Await myPinger.SendPingAsync(ipHost, timeout) If myReply.Status = IPStatus.Success Then successCount += 1 End If Catch ex As Exception 'Ping Failed End Try Next End Using If successCount / totalPingsToTry >= 0.7 Then MsgBox(String.Format("Destination Available - Hit Success Was {0}", (successCount / totalPingsToTry).ToString("P2"))) Else MsgBox(String.Format("Destination Is Not Available - Hit Success Was {0}", (successCount / totalPingsToTry).ToString("P2"))) End If Me.UseWaitCursor = False End Sub
https://www.vbforums.com/showthread....Accuracy-issue

Rispondi quotando