changed socket connected() method to const