Send a binary message, followed by EOL.
193699
def sendline(sock, msg, confidential=False):
    """"""
    log.debug('<- %r', ('<snip>' if confidential else msg))
    sock.sendall(msg + b'\n')
481420
def from_binary_string(self, notification):
        """"""
        command = struct.unpack('>B', notification[0])[0]

        if command != self.COMMAND:
            raise NotificationInvalidCommandError()

        length = struct.unpack('>I', notification[1:5])[0]
        notification = notification[5:]
        offset = 0

        def next_item(offset):
            iden, length = struct.unpack('>BH', notification[offset:offset+3])
            offset += 3
            payload = notification[offset:offset+length]
            offset += length

            if iden == self.PAYLOAD:
                payload = struct.unpack('>{0}s'.format(length), payload)[0]
                self.payload = json.loads(payload)
            elif iden == self.TOKEN:
                payload = struct.unpack('>{0}s'.format(length), payload)[0]
                self.token = binascii.hexlify(payload)
            elif iden == self.PRIORITY:
                self.priority = struct.unpack('>B', payload)[0]
            elif iden == self.NOTIFICATION_ID:
                self.iden = struct.unpack('>I', payload)[0]
            elif iden == self.EXPIRE:
                payload = struct.unpack('>I', payload)[0]
                self.expire = (self.EXPIRE_IMMEDIATELY if payload == 0 else
                               datetime.fromtimestamp(payload))
            else:
                raise NotificationInvalidIdError()

            return offset

        while offset < length:
            offset = next_item(offset)
1355533
def send_sysex(self, sysex_cmd, data):
        
        msg = bytearray([START_SYSEX, sysex_cmd])
        msg.extend(data)
        msg.append(END_SYSEX)
        self.sp.write(msg)
204487
def send(self, msg_dict):
        """"""
        message = ejson.dumps(msg_dict)
        super(DDPSocket, self).send(message)
        self._debug_log('<<<{}'.format(message))
1070809
def make_message(message, binary=False):
    """"""
    if isinstance(message, str):
        message = message.encode('utf-8')

    if binary:
        return _make_frame(message, OPCODE_BINARY)
    else:
        return _make_frame(message, OPCODE_TEXT)
316971
def send(command, data):
    
    global _lock
    try:
        _lock.acquire()
        data = data.encode('utf8')
        assert len(data) < 1000000, 'Command too long'
        msg = b'%b%06d%b' % (command.value, len(data), data)
        logging.getLogger(__name__).debug('Sending command, data: [%s]' % msg)
        _out_file.write(msg)
        _out_file.flush()
    finally:
        _lock.release()
1092578
def send_exit_with_code(cls, sock, code):
    """"""
    encoded_exit_status = cls.encode_int(code)
    cls.send_exit(sock, payload=encoded_exit_status)
570226
def send_stdout(cls, sock, payload):
    """"""
    cls.write_chunk(sock, ChunkType.STDOUT, payload)
154948
def SendSerializedMessage(self, message):
        
        try:
            ba = Helper.ToArray(message)
            ba2 = binascii.unhexlify(ba)
            self.bytes_out += len(ba2)
            self.transport.write(ba2)
        except Exception as e:
            logger.debug(f"Could not send serialized message {e}")
673257
def send_message(self, msg_dict):
        """"""
        with self._writer_lock:
            try:
                self.output_stream.flush()
                self.output_stream.write(self.serialize_dict(msg_dict))
                self.output_stream.flush()
            except IOError:
                raise StormWentAwayError()
            except:
                log.exception("Failed to send message: %r", msg_dict)
1300465
def _send_status_0x01_request(self):
        """"""
        status_command = StandardSend(self._address,
                                      COMMAND_LIGHT_STATUS_REQUEST_0X19_0X01)
        self._send_method(status_command, self._status_message_received)
1061056
def send_message(self, data):
        
        opcode = BINARY
        if _check_unicode(data):
            opcode = TEXT

        self._send_message(False, opcode, data)
382573
def message_from_binary_file(fp, *args, **kws):
    
    from future.backports.email.parser import BytesParser
    return BytesParser(*args, **kws).parse(fp)
15989
def maybe_send(self, recipient: Address, message: Message):
        

        if not is_binary_address(recipient):
            raise InvalidAddress('Invalid address {}'.format(pex(recipient)))

        messagedata = message.encode()
        host_port = self.get_host_port(recipient)

        self.maybe_sendraw(host_port, messagedata)
1347157
def write_message(self, message, binary=False, locked=True):
        ''' 

        '''
        if locked:
            with (yield self.write_lock.acquire()):
                yield super(WSHandler, self).write_message(message, binary)
        else:
            yield super(WSHandler, self).write_message(message, binary)
751643
def send(self, message, level=Level.NOTICE):
    ""
    data = "<%d>%s" % (level + self.facility*8, message)
    if self.protocol == 'UDP':
        self.socket.sendto(data.encode('utf-8'), (self.host, self.port))
    else:
        self.socket.send(data.encode('utf-8'))
1046112
def send_message(self, msg, stats=True, binary=False):
        
        self.send_jsonified(proto.json_encode(bytes_to_str(msg)), stats)