def sending_loop(self):
        """Sending loop which transmits data from the sending queue to the
        remote socket.

        This method is run as a thread.
        """
        try:
            while not self.done:
                msg = self.sending_queue.get()

                if not msg.startswith('dmd_frame'):
                    self.log.debug('Sending "%s"', msg)

                try:
                    self.connection.sendall(msg + '\n')
                except (__HOLE__, socket.error):
                    pass
                    # Do we just keep on trying, waiting until a new client
                    # connects?

            self.socket.close()
            self.socket = None

            self.mc.socket_thread_stopped()

        except Exception:
            exc_type, exc_value, exc_traceback = sys.exc_info()
            lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
            msg = ''.join(line for line in lines)
            self.mc.crash_queue.put(msg)
dataset/ETHPy150Open missionpinball/mpf/mpf/media_controller/core/bcp_server.py/BCPServer.sending_loop