mirror of
https://github.com/S7NetPlus/s7netplus.git
synced 2026-02-17 14:28:25 +08:00
plc: implemented shutdown of the socket correctly (Issue #29).
Signed-off-by: Michele Cattafesta <michele.cattafesta@mesta-automation.com>
This commit is contained in:
@@ -143,11 +143,15 @@ namespace S7.Net
|
||||
return response;
|
||||
}
|
||||
|
||||
public void Shutdown(SocketShutdown how)
|
||||
{
|
||||
_socket.Shutdown(how);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
if (_socket != null)
|
||||
{
|
||||
_socket.Shutdown(SocketShutdown.Both);
|
||||
_socket.Dispose();
|
||||
_socket = null;
|
||||
}
|
||||
|
||||
@@ -242,6 +242,7 @@ namespace S7.Net
|
||||
{
|
||||
if (_mSocket != null && _mSocket.Connected)
|
||||
{
|
||||
_mSocket.Shutdown(SocketShutdown.Both);
|
||||
_mSocket.Close();
|
||||
}
|
||||
}
|
||||
@@ -1096,6 +1097,7 @@ namespace S7.Net
|
||||
if (_mSocket.Connected)
|
||||
{
|
||||
//Close() performs a Dispose on the socket.
|
||||
_mSocket.Shutdown(SocketShutdown.Both);
|
||||
_mSocket.Close();
|
||||
}
|
||||
//((IDisposable)_mSocket).Dispose();
|
||||
|
||||
Reference in New Issue
Block a user