Send string over TCP to the specified address via the specified port, including a header.

@param message string to be sent over TCP
@param retries number of times to retry in event of failure
@return true if message was successfully sent
168740
public boolean sendTCPString(String message, int retries)
    {
        Log(Level.FINE, "About to send: " + message);
        byte[] bytes = message.getBytes();
        return sendTCPBytes(bytes, retries);
    }
1005625
public boolean sendMessage( Serializable payload ) {
        if (!isOpen() || !multipleMembersInCluster()) {
            return false;
        }

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("{0} SENDING {1} ", toString(), payload);
        }
        try {
            byte[] messageData = toByteArray(payload);
            Message jgMessage = new Message(null, channel.getAddress(), messageData);
            channel.send(jgMessage);
            return true;
        } catch (Exception e) {
            // Something went wrong here
            throw new SystemFailureException(ClusteringI18n.errorSendingMessage.text(clusterName()), e);
        }
    }
384183
public static void transfer(InputStream in, byte[] bytes) throws IOException
    {
        // Read in the bytes
        int offset = 0;
        int numRead;
        while (offset < bytes.length && (numRead = in.read(bytes, offset, bytes.length - offset)) >= 0)
        {
            offset += numRead;
        }

        if (offset < bytes.length)
        {
            throw new IOException("Retry:  Not all bytes were transferred correctly.");
        }
    }
779980
public void sendTextMessage(String message) {
		MessageEnvelope envelope = new MessageEnvelope();
		ReceivedMessage body = new ReceivedMessage();

		body.setText(message);
		envelope.setMessage(body);
		envelope.setSender(new User(facebookMockId));

		System.out.println("Sending message: [" + message + "] as user : ["
				+ facebookMockId + "].");
		forward(envelope);
		System.out.println("Sent!");
	}
65343
public synchronized Boolean sendMessage(TransmittableMessage message) {
        if (!start()) {
            log.error("Firmata library is not connected / started! Cannot send message {}",
                    message.getClass().getSimpleName());
            return false;
        }

        try {
            log.debug("Transmitting message {}. Bytes: {}", message.getClass().getSimpleName(),
                    FirmataHelper.bytesToHexString(message.toByteArray()));
            serialPort.getOutputStream().write(message.toByteArray());
            return true;
        } catch (IOException e) {
            log.error("Unable to transmit message {} through serial port", message.getClass().getName());
            stop();
        }

        return false;
    }
760303
public boolean isSendRemoteMessage(BaseMessage message)
    {
        if (message instanceof RecordMessage)   // Always
        {
            RecordMessageHeader recMessageHeader = (RecordMessageHeader)message.getMessageHeader();
            int iChangeType = recMessageHeader.getRecordMessageType();
            if (m_iDatabaseType == recMessageHeader.getDatabaseType())
                if (DBParams.CLIENT.equals(recMessageHeader.getSourceType()))   // Don't send only if Client DB is handling these messages.
            {
                if (!(this instanceof GridRecordMessageFilter))
                    if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE)
                        || (iChangeType == DBConstants.AFTER_ADD_TYPE)
                        || (iChangeType == DBConstants.AFTER_DELETE_TYPE))
                            return false;    // The remote version of me handles this message remotely.
                if (this instanceof GridRecordMessageFilter)
                    if (iChangeType == DBConstants.AFTER_REQUERY_TYPE)
                        return false;    // The remote version of me handles this message remotely.
            }
        }
        return super.isSendRemoteMessage(message);
    }
883496
@Override
    public void sendRequestHeaders() throws IOException, MessageSentException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "sendRequestHeaders(sync)");
        }
        if (headersSent()) {
            throw new MessageSentException("Headers already sent");
        }

        setPartialBody(true);
        getLink().setAllowReconnect(true);
        try {
            sendHeaders(getRequestImpl());
        } catch (IOException e) {
            // no FFDC required
            reConnect(e);
        }
        // check to see if we need to read the response now
        if (shouldReadResponseImmediately()) {
            startResponseReadSync();
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "sendRequestHeaders(sync)");
        }
    }
986620
protected void sendMessage(String dest, Message message) {
    if (LOG.isTraceEnabled()) {
      LOG.trace("Sends message {} to {}.",
                TextFormat.shortDebugString(message),
                dest);
    }
    this.transport.send(dest, message);
  }
1328785
public synchronized long sendMessage(AbstractRequestMessage message) {
    log.debug("Sending {} to {}", message, this);
    message.setTicketNumber(this.nextTicketNumber.getAndIncrement());
    this.outstandingRequests.put(Long.valueOf(message.getTicketNumber()),
        message);
    this.session.write(message);
    return message.getTicketNumber();
  }
661213
def send(self, message):
        
        url = '{0}message'.format(self.remote)
        data = self._wrap_post_data(content=message)
        res = requests.post(url, data=data, timeout=self.timeout)
        if res.status_code == requests.codes.ok:
            res_data = json.loads(self._convert_bytes(res.content))
            if res_data.get('status') == STATUS_SUCCESS:
                return True, res_data.get('message')
            return False, res_data.get('message')
        res.raise_for_status()
        return False, 'Request or Response Error'
1216467
public void sendMessage(Message message) throws RemoteException
    {
        BaseTransport transport = this.createProxyTransport(SEND_MESSAGE);
        transport.addParam(MESSAGE, message);   // Don't use COMMAND
        transport.sendMessageAndGetReply();
    }
1321249
public void sendMessage(final String message) {
        try {
            session.sendMessage(new TextMessage(message));
        }
        catch (IOException e) {
            logger.error("[sendTextMessage]", e);
        }
    }
319427
def custodian_azure_send_override(self, request, headers=None, content=None, **kwargs):
    
    retries = 0
    max_retries = 3
    while retries < max_retries:
        response = self.orig_send(request, headers, content, **kwargs)

        send_logger.debug(response.status_code)
        for k, v in response.headers.items():
            if k.startswith('x-ms-ratelimit'):
                send_logger.debug(k + ':' + v)

        # Retry codes from urllib3/util/retry.py
        if response.status_code in [413, 429, 503]:
            retry_after = None
            for k in response.headers.keys():
                if StringUtils.equal('retry-after', k):
                    retry_after = int(response.headers[k])

            if retry_after is not None and retry_after < constants.DEFAULT_MAX_RETRY_AFTER:
                send_logger.warning('Received retriable error code %i. Retry-After: %i'
                                    % (response.status_code, retry_after))
                time.sleep(retry_after)
                retries += 1
            else:
                send_logger.error("Received throttling error, retry time is %i"
                                  "(retry only if < %i seconds)."
                                  % (retry_after, constants.DEFAULT_MAX_RETRY_AFTER))
                break
        else:
            break
    return response
1231978
private void sendAck()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "sendAck");

        long completedPrefix = oststream.getCompletedPrefix();

        // Now that all messages are delivered we need to send Acks
        // sendAck back to sending ME (RemoteMessageTransmitter)
        try
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(tc, "sendAck up to: " + completedPrefix);

            upControl.sendAckMessage(
                                     streamSet.getRemoteMEUuid(),
                                     streamSet.getDestUuid(),
                                     streamSet.getBusUuid(),
                                     completedPrefix,
                                     priority,
                                     reliability,
                                     streamSet.getStreamID(),
                                     true);
            this._lastAckedTick = completedPrefix;
        } catch (SIResourceException e)
        {
            //FFDC
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.gd.GuaranteedTargetStream.sendAck",
                                        "1:2019:1.110",
                                        this);

            SibTr.exception(tc, e);

            //TODO don't know what to do here - rethrow?!
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "sendAck");
    }
1119929
private void send( String message ) {

		if( ! this.enabled.get()) {
			this.logger.finest( "Notifications were disabled by the DM." );

		} else if( message == null ) {
			this.logger.finest( "No message to send to web socket clients." );

		} else synchronized( SESSIONS ) {
			for( Session session : SESSIONS ) {
				try {
					this.logger.finest( "Sending a message to a web socket client..." );
					session.getRemote().sendString( message );

				} catch( IOException e ) {
					StringBuilder sb = new StringBuilder( "A notification could not be propagated for session " );
					sb.append( session.getRemoteAddress());
					sb.append( "." );
					if( ! Utils.isEmptyOrWhitespaces( e.getMessage()))
						sb.append( " " + e.getMessage());

					this.logger.severe( sb.toString());
					Utils.logException( this.logger, e );
				}
			}
		}
	}
198847
def send(self, payloads, logger, num_tries=5):
        
        from time import sleep

        backoff_interval = 1
        backoff_factor = 2

        for try_counter in xrange(0, num_tries):
            failed_messages = self.send_without_retry(payloads)

            # success!
            if not failed_messages:
                payloads = []
                break

            # output some information about the failures for debugging
            # purposes. we expect failures to be quite rare, so we can be
            # pretty verbose.
            if logger:
                for msg in failed_messages:
                    logger.warning("Failed to send message on try %d: Id=%r, "
                                   "SenderFault=%r, Code=%r, Message=%r" %
                                   (try_counter, msg['Id'],
                                    msg.get('SenderFault'), msg.get('Code'),
                                    msg.get('Message')))

            # wait a little while, in case the problem is that we're talking
            # too fast.
            sleep(backoff_interval)
            backoff_interval *= backoff_factor

            # filter out the failed payloads for retry
            retry_payloads = []
            for msg in failed_messages:
                i = int(msg['Id'])
                retry_payloads.append(payloads[i])
            payloads = retry_payloads

        if payloads:
            raise Exception('Messages failed to send to sqs after %d '
                            'retries: %s' % (num_tries, len(payloads)))
395710
public boolean sendMessage(WebSocketMessage<?> message) {
        boolean sentSuccessfully = false;
        if (sessions.isEmpty()) {
            LOG.warn("No Web Socket session exists - message cannot be sent");
        }

        for (WebSocketSession session : sessions.values()) {
            if (session != null && session.isOpen()) {
                try {
                    session.sendMessage(message);
                    sentSuccessfully = true;
                } catch (IOException e) {
                    LOG.error(String.format("(%s) error sending message", session.getId()), e);
                }
            }
        }
        return sentSuccessfully;
    }