Catch socket errors too.