def listen(self):
<EOL>if self.mode and self.mode != '<STR_LIT>':<EOL><INDENT>raise ValueError("<STR_LIT>" %<EOL>self.__class__.__name__)<EOL><DEDENT>self.mode = '<STR_LIT>'<EOL>serv = _create_server(self.host, self.port)<EOL>err_thresh = <NUM_LIT:0><EOL>while True:<EOL><INDENT>try:<EOL><INDENT>sock, addr = serv.accept()<EOL><DEDENT>except Exception as exc:<EOL><INDENT>err_thresh += <NUM_LIT:1><EOL>if err_thresh >= self.max_err_thresh:<EOL><INDENT>LOG.exception("<STR_LIT>"<EOL>"<STR_LIT>" % str(exc))<EOL>break<EOL><DEDENT>continue  <EOL><DEDENT>err_thresh = max(err_thresh - <NUM_LIT:1>, <NUM_LIT:0>)<EOL>LOG.info("<STR_LIT>" %<EOL>(addr[<NUM_LIT:0>], addr[<NUM_LIT:1>]))<EOL>eventlet.spawn_n(self.serve, self.connection_class(sock), addr)<EOL><DEDENT>with utils.ignore_except():<EOL><INDENT>serv.close()<EOL><DEDENT>
Listen for clients.  This method causes the SimpleRPC object
to switch to server mode.  One thread will be created for each
client.