Low-level function to send message bytes to this Sender's socket.
        You should usually call send() instead of this function (unless you're
        subclassing or writing unit tests).
969820
def send_socket(self, message):
        
        if self.log_sends:
            start_time = time.time()
        try:
            self.send_message(message)
        except Exception as error:
            logger.error('error sending message {!r}: {}'.format(message, error))
        else:
            if self.log_sends:
                elapsed_time = time.time() - start_time
                logger.info('sent message {!r} to {}:{} in {:.03f} seconds'.format(
                        message, self.host, self.port, elapsed_time))
1241285
def send_data(self, message):
        '''
            
        '''
        #logger.debug("TX:\n%s", json.dumps(message, indent=2))
        data = json.dumps(message).encode('utf-8') + b'\n'
        self.transport.write(data)
313525
def _send_method(self, method_sig, args=bytes(), content=None):
        
        if isinstance(args, AMQPWriter):
            args = args.getvalue()

        self.connection.method_writer.write_method(self.channel_id,
            method_sig, args, content)
961733
public void sendMessage(String message){

		byte[] datagramData = message.getBytes();
		datagramPacket.setData(datagramData);

		try {
			datagramSocket.send(datagramPacket);
		} catch (IOException e) {
			Log.e(TAG, "Failed to send datagram log " + e);
		}
	}
782984
def send_message(self, message, channel):
        
        if not self.is_connected(channel):
            return False

        message['_sending'] = True

        if '_data' in message:
            data = message['_data']
        else:
            data = msgpack.packb(message, default=invalid_json_values)
            self.bytes_total += len(data)
            message['_bytes_sent'] = 0
            message['_id'] = -1

        if is_debug2():
            sys.__stderr__.write("[%s] send message: %s\n" % (channel, str(msgpack.unpackb(data))[0:180]))

        try:
            while data:
                start = time.time()
                bytes_sent = self.ssh_channel[channel].send(data)

                data = data[bytes_sent:]
                message['_bytes_sent'] += bytes_sent
                self.bytes_sent += bytes_sent

                end = time.time()
                self.write_speeds.append(bytes_sent / (end-start))

                speeds_len = len(self.write_speeds)
                if speeds_len:
                    self.bytes_speed = sum(self.write_speeds) / speeds_len
                    if speeds_len > 10:
                        self.write_speeds = self.write_speeds[5:]

            message['_sent'] = True
            return True

        except (KeyboardInterrupt, SystemExit):
            if message['_sent']:
                return message['_bytes_sent']

            return False

        except Exception as error:
            self.connection_error(channel, error)
            return False
176636
def _dispatch_send(self, message):
        

        if self.dryrun:
            return message

        if not self.socket:
            raise GraphiteSendException(
                "Socket was not created before send"
            )

        sending_function = self._send
        if self._autoreconnect:
            sending_function = self._send_and_reconnect

        try:
            if self.asynchronous and gevent:
                gevent.spawn(sending_function, message)
            else:
                sending_function(message)
        except Exception as e:
            self._handle_send_error(e)

        return "sent {0} long message: {1}".format(len(message), message[:75])
1274971
def send(self, data):
        
        answer = None
        try:
            logging.info("Client conntecting to {server}".format(server=self.server_address))
            if six.PY2:
                sock = socket.socket(family=socket.AF_UNIX, type=socket.SOCK_STREAM)
                answer = self.sending(sock, data)
                sock.close()
            else:
                with socket.socket(family=socket.AF_UNIX, type=socket.SOCK_STREAM) as sock:
                    answer = self.sending(sock, data)

        except socket.error as e:
            logging.error("Client cannot conntect to {server}: {msg}".format(server=self.server_address, msg=e.strerror))
            return None

        return answer
952443
def socket_send(self):
        
        if len(self.send_buffer):
            try:
                sent = self.sock.send(self.send_buffer)
            except socket.error, err:
                print("!! SEND error '%d:%s' from %s" % (err[0], err[1],
                    self.addrport()))
                self.active = False
                return
            self.bytes_sent += sent
            self.send_buffer = self.send_buffer[sent:]
        else:
            self.send_pending = False
1313591
def send(self, payload, *args, **kwargs):
        
        if isinstance(payload, (list, dict)):
            payload = json.dumps(payload)

        self.sendMessage(payload.encode(), *args, **kwargs)
435319
def send(self, data):
        
        sock = socket.socket(*self.sock_args)
        try:
            sock.connect(self.sock_addr)
        except socket.error as exc:
            raise socket.error("Can't connect to %r (%s)" % (self.url.geturl(), exc))

        try:
            # Send request
            sock.send(data)

            # Read response
            while True:
                chunk = sock.recv(self.CHUNK_SIZE)
                if chunk:
                    yield chunk
                else:
                    break
        finally:
            # Clean up
            sock.close()
508436
void sendMessage(IMessage message) throws IOException, AvpDataException, NotInitializedException, ParseException {

    if (!isConnected()) {
      throw new IOException("Failed to send message over [" + socketDescription + "]");
    }

    //switch to wait for SSL handshake to workout.
    if (!isExchangeAllowed()) {
      //TODO: do more?
      return;
    }

    doTLSPreSendProcessing(message);

    final ByteBuffer messageBuffer = this.parser.encodeMessage(message);
    if (logger.isDebugEnabled()) {
      logger.debug("About to send a byte buffer of size [{}] over the TLS socket [{}]", messageBuffer.array().length, socketDescription);
    }
    lock.lock();
    try {
      this.outputStream.write(messageBuffer.array(), messageBuffer.position(), messageBuffer.limit());
      doTLSPostSendProcessing(message);

    } catch (Exception e) {
      logger.debug("Unable to send message", e);
      throw new IOException("Error while sending message: " + e);
    }
    finally {
      lock.unlock();
    }

    if (logger.isDebugEnabled()) {
      logger.debug("Sent a byte buffer of size [{}] over the TLS nio socket [{}]", messageBuffer.array().length, socketDescription);
    }
  }
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}")
1106451
def _dgram_send_and_receive(self, _socket, message, buffer_size=4096, *args):
        """"""
        _socket.send(message.encode('utf-8'))
        data, address = _socket.recvfrom(buffer_size)
        return BytesIO(data)
971733
def send_msg(self, connection, data):
        
        # serialize as JSON
        msg = json.dumps(data)
        # Prefix each message with a 4-byte length (network byte order)
        msg = struct.pack('>I', len(msg)).decode() + msg
        connection.sendall(msg.encode())
        return
1255858
def send(self):
        
        buf_sz = 500
        to_send = {}

        for mn in self.data.iterkeys():
            while len(self.data[mn]) > 0:
                l = len(to_send)
                if l < buf_sz:
                    to_send.setdefault(mn, [])
                    to_send[mn].append(self.data[mn].pop())
                else:
                    try:
                        self._send(to_send)
                        to_send = {}
                        to_send.setdefault(mn, [])
                        to_send[mn].append(self.data[mn].pop())
                    except socket.error:
                        self.logger.error('Error sending to carbon, trying to reconnect.')
                        self.sock = self._connect()

                        # we failed to send, so put it back in the stack and try later
                        for ent in to_send:
                            self.data[ent[0]].append(ent[1])

        try:
            self._send(to_send)
        except socket.error:
            self.logger.error('Error sending to carbon, trying to reconnect.')
            self.sock = self._connect()

        # we failed to send, so put it back in the stack and try later
        for ent in to_send:
            self.data[ent[0]].append(ent[1])
935167
def send(self, data):
        """"""
        # send message
        _LOGGER.debug("send: " + data)
        self.socket.send(data.encode('ascii'))
        # sleep needed to prevent flooding the GC100 with sends
        sleep(.01)
1119688
def send(self,message,message_type,topic=''):
        
        if message_type == RAW:
            self._sock.send(message)
        elif message_type == PYOBJ:
            self._sock.send_pyobj(message)
        elif message_type == JSON:
            self._sock.send_json(message)
        elif message_type == MULTIPART:
            self._sock.send_multipart([topic, message])
        elif message_type == STRING:
            self._sock.send_string(message)
        elif message_type == UNICODE:
            self._sock.send_unicode(message)
        else:
            raise Exception("Unknown message type %s"%(message_type,))