Remove most of socket_perror usage.