Send the data over the wire to this client.

 data - The XML String or XML::Node to write to the socket.

 Returns nothing.
424384
def write(data)
      log_node(data, :out)
      if data.respond_to?(:to_xml)
        data = data.to_xml(:indent => 0)
      end
      send_data(data)
    end
1280804
def _send(self, line):
        
        if not line.endswith('\r\n'):
            if line.endswith('\n'):
                logger.debug('Fixing bare LF before sending data to socket')
                line = line[0:-1] + '\r\n'
            else:
                logger.debug(
                    'Fixing missing CRLF before sending data to socket')
                line = line + '\r\n'
        logger.debug('Client sent: ' + line.rstrip())
        self._socket.send(line)
517597
def send_data(self, data=None):
        
        save_in_error = False
        if not data:
            if self.__data_lock.acquire():
                data = self.__data
                self.__data = []
                save_in_error = True
                self.__data_lock.release()
            else:
                return False
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        payload = pickle.dumps(data, protocol=2)
        header = struct.pack("!L", len(payload))
        message = header + payload
        s.settimeout(1)
        s.connect((self.host, self.port))
        try:
            s.send(message)
        except:
            # log.exception('Error when sending data to carbon')
            if save_in_error:
                self.__data.extend(data)
            return False
        else:
            # log.debug('Sent data to {host}:{port}: {0} metrics, {1} bytes'.format(len(data),
            #   len(message), host = self.host, port=self.port))
            return True
        finally:
            s.close()
855538
def _send(self):
        
        data = self.output_buffer.view()
        if not data:
            return
        if self.closed():
            raise self.Error("Failed to write to closed connection {!r}".format(self.server.address))
        if self.defunct():
            raise self.Error("Failed to write to defunct connection {!r}".format(self.server.address))
        self.socket.sendall(data)
        self.output_buffer.clear()
1297736
def _send_socket_request(self, xml_request):
        
        def to_variant(number):
            buff = []
            while number:
                byte = number % 128
                number = number // 128
                if number > 0:
                    byte |= 0x80
                buff.append(chr(byte))
            return ''.join(buff)

        def from_variant(stream):
            used = 0
            number = 0
            q = 1
            while True:
                byte = ord(stream[used])
                used += 1
                number += q * (byte & 0x7F)
                q *= 128
                if byte&0x80==0:
                    break
            return (number, used)

        def encode_fields(fields):
            chunks = []
            for field_id, message in fields.items():
                chunks.append(to_variant((field_id << 3) | 2)) # Hardcoded WireType=2
                chunks.append(to_variant(len(message)))
                chunks.append(message)
            return ''.join(chunks)

        def decode_fields(stream):
            fields = {}
            offset = 0
            stream_lenght = len(stream)
            while offset<stream_lenght:
                field_header, used = from_variant(stream[offset:])
                offset += used
                wire_type = field_header & 0x07
                field_id = field_header >> 3
                if wire_type==2:
                    message_lenght, used = from_variant(stream[offset:])
                    offset += used
                    fields[field_id] = stream[offset:offset+message_lenght]
                    offset += message_lenght
                elif wire_type==0:
                    fields[field_id], used = from_variant(stream[offset:])
                    offset += used
                elif wire_type==1:
                    fields[field_id] = stream[offset:offset+8]
                    offset += 8
                elif wire_type==3:
                    raise ConnectionError()
                elif wire_type==4:
                    raise ConnectionError()
                elif wire_type==5:
                    fields[field_id] = stream[offse:offset+4]
                    offset += 4
                else:
                    raise ConnectionError()
            return fields


        def make_header(lenght):
            result = []
            result.append(chr((lenght & 0x000000FF)))
            result.append(chr((lenght & 0x0000FF00) >> 8))
            result.append(chr((lenght & 0x00FF0000) >> 16))
            result.append(chr((lenght & 0xFF000000) >> 24))
            return '\t\t\x00\x00' + ''.join(result)

        def parse_header(header):
            if len(header) == 8 and header[0] == '\t' and header[1] == '\t' and\
                    header[2] == '\00' and header[3] == '\00':
                return ord(header[4]) | (ord(header[5]) << 8) |\
                        (ord(header[6]) << 16) | (ord(header[7]) << 24)
            else:
                raise ConnectionError()

        def socket_send(data):
            sent_bytes = 0
            failures = 0
            total_bytes = len(data)
            while sent_bytes < total_bytes:
                sent = self._connection.send(data[sent_bytes:])
                if sent == 0:
                    failures += 1
                    if failures > 5:
                        raise ConnectionError()
                    continue
                sent_bytes += sent

        def socket_recieve(lenght):
            total_recieved = 0
            failures = 5
            recieved_chunks = []
            while total_recieved<lenght:
                chunk = self._connection.recv(lenght-total_recieved)
                if not chunk:
                    failures += 1
                    if failures > 5:
                        raise ConnectionError()
                    continue
                recieved_chunks.append(chunk)
                total_recieved += len(chunk)
            return ''.join(recieved_chunks)

        encoded_message = encode_fields({1: xml_request,
                                         2: self._storage if self._storage else "special:detect-storage"})
        header = make_header(len(encoded_message))

        try: # Retry once if failed in case the socket has just gone bad.
            socket_send(header+encoded_message)
        except (ConnectionError, socket.error):
            self._connection.close()
            self._open_connection()
            socket_send(header+encoded_message)

        # TODO: timeout
        header = socket_recieve(8)
        lenght = parse_header(header)
        encoded_response = socket_recieve(lenght)
        response = decode_fields(encoded_response)
        # TODO: Test for id=3 error message
        # TODO: check for and raise errors
        return response[1]
1374611
async def send(self, data: Union[bytes, str], final: bool = True):
        
        MsgType = TextMessage if isinstance(data, str) else BytesMessage
        data = MsgType(data=data, message_finished=final)
        data = self._connection.send(event=data)
        await self._sock.send_all(data)
693605
def send(self, data):
        
        start = time.time()
        try:
            scgi_resp = ''.join(self.transport.send(_encode_payload(data)))
        finally:
            self.latency = time.time() - start

        resp, self.resp_headers = _parse_response(scgi_resp)
        return resp
1066321
def send(self, data):
        """"""
        bytes_sent = self._sock.send(extract_bytes(data))
        self.bytes_written += bytes_sent
        return bytes_sent
1126994
def send(self):
        
        xml_request = self.get_xml_request()
        if(self.connection._debug == 1):
            print(xml_request)
        Debug.warn('-' * 25)
        Debug.warn(self._command)
        Debug.dump("doc: \n", self._documents)
        Debug.dump("cont: \n", self._content)
        Debug.dump("nest cont \n", self._nested_content)
        Debug.dump("Request: \n", xml_request)


        response = _handle_response(self.connection._send_request(xml_request),
                                         self._command, self.connection.document_id_xpath)
        # TODO: jāpabeidz debugs 
        # if(self.connection._debug == 1):
        #     # print(response)
        #     print(format(ET.tostring(response)))
        return response
828507
def receive_data(data)
      @data << data

      return unless data.index("\n\n")
      begin
        result = _receive_data(@data)
      rescue
        raise
        result = nil
      end
      @callback.call(!result.nil?, result) unless @callback.nil?
      @callback = nil
      @available = true
    end
795833
def write(self, data):
        

        while data:
            try:
                n = self._socket.send(data)
            except socket.error:
                n = None
            if not n:
                raise EOFError('Socket closed')
            data = data[n:]
1145968
public void write(final String data) throws IOException {
        if (socket != null) {
            out.write(data.getBytes());
        }
    }
377377
def send(self, message):
        
        self.socket.sendto(message.SerializeToString(), self.address)
        return None
475989
def write(self, data):
        

        try:
            ret = self._wrap_socket_library_call(
                lambda: SSL_write(self._ssl.value, data), ERR_WRITE_TIMEOUT)
        except openssl_error() as err:
            if err.ssl_error == SSL_ERROR_SYSCALL and err.result == -1:
                raise_ssl_error(ERR_PORT_UNREACHABLE, err)
            raise
        if ret:
            self._handshake_done = True
        return ret
1175886
def _send(self, data):
        
        # check link
        if self.__sock is None:
            self.__debug_msg('call _send on close socket')
            return None
        # send
        data_l = len(data)
        try:
            send_l = self.__sock.send(data)
        except socket.error:
            send_l = None
        # handle send error
        if (send_l is None) or (send_l != data_l):
            self.__last_error = const.MB_SEND_ERR
            self.__debug_msg('_send error')
            self.close()
            return None
        else:
            return send_l
1126910
def write
      node = to_rxf_node(@members.root , 0)
      io = StringIO.new
      node.out( io , 0 )
      io.string
    end
583523
def send(self, data, flags=0):
        '''
        
        '''
        if self._remote_addr == (None,None):
            raise sockerr("ENOTCONN: socket not connected")
        return self._send(data, self._flowaddr())