diff --git a/Sharp7/S7Client.cs b/Sharp7/S7Client.cs index 06aea3a..be06749 100644 --- a/Sharp7/S7Client.cs +++ b/Sharp7/S7Client.cs @@ -723,7 +723,10 @@ namespace Sharp7 public int Disconnect() { - Socket.Close(); + if (Socket != null && Socket.Connected) + { + Socket.Close(); + } return 0; }