Improve error messages for socket error.