示例#1
0
        /// <summary>
        /// Disconnect from the end unit.
        /// </summary>
        public void Disconnect()
        {
            _tcpClient?.Close();
            _frameBuffer?.Dispose();

            // workaround for https://github.com/Apollo3zehn/FluentModbus/issues/44#issuecomment-747321152
            if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase))
            {
                _tcpClient = null;
            }
        }
示例#2
0
 /// <summary>
 /// Closes the opened COM port and frees all resources.
 /// </summary>
 public void Close()
 {
     _serialPort?.Close();
     _frameBuffer?.Dispose();
     _messageBuffer?.Dispose();
 }
示例#3
0
 /// <summary>
 /// Disconnect from the end unit.
 /// </summary>
 public void Disconnect()
 {
     _tcpClient?.Close();
     _frameBuffer?.Dispose();
 }