Example #1
0
        void DisconnectInternal()
        {
            if (status == TcpConnectionStatus.Disconnected)
            {
                return;
            }

            var socket = clientSocket;

            if (socket != null)
            {
                socket.Dispose();
                clientSocket = null;
            }
            var connection = Connection;

            if (connection != null)
            {
                connection.Close();
                Connection = null;
            }
            ChangeStatus(TcpConnectionStatus.Disconnected);
        }