Check if connected before checking if keep-alive limit is expired