def send_message(self, msg):
        """Send any kind of message.

        Parameters
        ----------
        msg : Message object
            The message to send.

        """
        assert get_thread_ident() == self.ioloop_thread_id
        data = str(msg) + "\n"
        # Log all sent messages here so no one else has to.
        if self._logger.isEnabledFor(logging.DEBUG):
            self._logger.debug("Sending to {}: {}"
                               .format(self.bind_address_string, repr(data)))
        if not self._connected.isSet():
            raise KatcpClientDisconnected('Not connected to device {0}'.format(
                self.bind_address_string))
        try:
            return self._stream.write(data)
        except Exception:
            self._logger.warn('Could not send message {0!r} to {1!r}'
                              .format(str(msg), self._bindaddr), exc_info=True)
            self._disconnect(exc_info=True)
def send_message ( self , msg ) : assert get_thread_ident ( ) == self . ioloop_thread_id data = str ( msg ) + "\n" if self . _logger . isEnabledFor ( logging . DEBUG ) : self . _logger . debug ( "Sending to {}: {}" . format ( self . bind_address_string , repr ( data ) ) ) if not self . _connected . isSet ( ) : raise KatcpClientDisconnected ( 'Not connected to device {0}' . format ( self . bind_address_string ) ) try : return self . _stream . write ( data ) except Exception : self . _logger . warn ( 'Could not send message {0!r} to {1!r}' . format ( str ( msg ) , self . _bindaddr ) , exc_info = True ) self . _disconnect ( exc_info = True )
Send any kind of message.

        Parameters
        ----------
        msg : Message object
            The message to send.