catch socket esceptions.