diff --git a/S7.Net/PLC.cs b/S7.Net/PLC.cs index f9715cc..2a29fc3 100644 --- a/S7.Net/PLC.cs +++ b/S7.Net/PLC.cs @@ -26,9 +26,19 @@ namespace S7.Net { get { - Ping ping = new Ping(); - PingReply result = ping.Send(IP); - return result != null && result.Status == IPStatus.Success; + using (Ping ping = new Ping()) + { + PingReply result; + try + { + result = ping.Send(IP); + } + catch (PingException) + { + result = null; + } + return result != null && result.Status == IPStatus.Success; + } } }