Ejemplo n.º 1
0
        /// <summary>
        /// Stops the proxy.
        /// </summary>
        /// <returns></returns>
        public Task StopAsync()
        {
            try
            {
                logger?.LogTrace("ModbusTcpTcpProxy.StopAsync enter");
                CheckDisposed();
                if (!isStarted)
                {
                    return(Task.CompletedTask);
                }

                isStarted = false;

                server?.Dispose();
                server = null;

                client?.Dispose();
                client = null;

                return(Task.CompletedTask);
            }
            finally
            {
                logger?.LogTrace("ModbusTcpTcpProxy.StopAsync leave");
            }
        }