Check connection periodically