def run(self):
while True:<EOL><INDENT>try:<EOL><INDENT>data = None<EOL>if self.debug:<EOL><INDENT>self.py3_wrapper.log("<STR_LIT>")<EOL><DEDENT>connection, client_address = self.sock.accept()<EOL>try:<EOL><INDENT>if self.debug:<EOL><INDENT>self.py3_wrapper.log("<STR_LIT>")<EOL><DEDENT>data = connection.recv(MAX_SIZE)<EOL>if data:<EOL><INDENT>data = json.loads(data.decode("<STR_LIT:utf-8>"))<EOL>if self.debug:<EOL><INDENT>self.py3_wrapper.log(u"<STR_LIT>" % data)<EOL><DEDENT>self.command_runner.run_command(data)<EOL><DEDENT><DEDENT>finally:<EOL><INDENT>connection.close()<EOL><DEDENT><DEDENT>except Exception:<EOL><INDENT>if data:<EOL><INDENT>self.py3_wrapper.log("<STR_LIT>")<EOL>self.py3_wrapper.log(data)<EOL><DEDENT>self.py3_wrapper.report_exception("<STR_LIT>")<EOL><DEDENT><DEDENT>
Main thread listen to socket and send any commands to the
CommandRunner.