Changed socket.err to socket.error.