协程的发送
@param $send
@param bool $oneway
@param callable|null $set
@return TcpClientRequestCoroutine
2211
public function coroutineSend($send, $oneway = false, callable $set = null)
    {
        return Pool::getInstance()->get(TcpClientRequestCoroutine::class)->init($this, $send, $oneway, $set);
    }
1227497
public function client_send($data)
    {
        $this->edebug("CLIENT -> SERVER: $data", self::DEBUG_CLIENT);
        return fwrite($this->smtp_conn, $data);
    }
1168031
def waypoint_set_current_send(self, seq):
        ''''''
        if self.mavlink10():
            self.mav.mission_set_current_send(self.target_system, self.target_component, seq)
        else:
            self.mav.waypoint_set_current_send(self.target_system, self.target_component, seq)
753704
public function coroutineSend($name, $arg, callable $set = null)
    {
        if (get_instance()->isTaskWorker()) {//如果是task进程自动转换为同步模式
            try {
                $value = sd_call_user_func_array([$this->getSync(), $name], $arg);
            } catch (\RedisException $e) {
                $this->redis_client = null;
                $value = sd_call_user_func_array([$this->getSync(), $name], $arg);
            }
            return $value;
        } else {
            return Pool::getInstance()->get(RedisCoroutine::class)->init($this, $name, $arg, $set);
        }
    }
545330
private function sendUsingStream ()
    {

        // Construct Headers

        $headers	= $this->constructHeaders ();

        // Create a new stream object

        $stream	= new Stream ('tcp://' . $this->smtp['server'], $this->smtp['port']);

        // If there was a stream error

        if ($stream->isError ())
        {

            // Add error and return FALSE

            new \Sonic\Message ('error', $stream->getErrors (TRUE));
            return FALSE;

        }

        // Receive

        if (!$stream->Receive ('220'))
        {

            // Add error and return FALSE

            new \Sonic\Message ('error', 'Initial Receive Failed: ' . $stream->getErrors (TRUE));
            return FALSE;

        }

        // Send EHLO

        if (!$stream->Send ('EHLO ' . $this->smtp['domain'], array ('220','250')))
        {

            // Attempt a second time, some SMTP servers seem to have a problem
            // where somewhat space is sent which causes the first EHLO to fail

            if (!$stream->Send ('EHLO ' . $this->smtp['domain'], array ('220','250')))
            {

                // Add error and return FALSE

                new \Sonic\Message ('error', 'EHLO Failed: ' . $stream->getErrors (TRUE));
                return FALSE;

            }

        }

        // Authenticate

        if ($this->smtp['username'] && $this->smtp['password'] && !$stream->Send ('AUTH LOGIN', array ('250','334')))
        {

            // Add error and return FALSE

            new \Sonic\Message ('error', 'AUTH LOGIN Failed: ' . $stream->getErrors (TRUE));
            return FALSE;

        }

        // Username

        if ($this->smtp['username'] && !$stream->Send (base64_encode ($this->smtp['username']), array ('250','334')))
        {

            // Add error and return FALSE

            new \Sonic\Message ('error', 'USERNAME Failed: ' . $stream->getErrors (TRUE));
            return FALSE;

        }

        // Password

        if ($this->smtp['password'] && !$stream->Send (base64_encode ($this->smtp['password']), '235'))
        {

            // Add error and return FALSE

            new \Sonic\Message ('error', 'PASSWORD Failed: ' . $stream->getErrors (TRUE));
            return FALSE;

        }

        // Get template resource

        $tpl	= \Sonic\Sonic::getResource ('tpl');

        // Set smarty template status

        $smarty	= $tpl instanceof \Smarty;

        // If we have a smarty template object

        if ($smarty)
        {

            // Get caching status

            $smartyPrevCache	= $tpl->caching;

            // Disable caching

            $tpl->setCaching (FALSE);

        }

        // For each recipient

        foreach ($this->_recipients as $recipient)
        {

            // Send email

            try
            {

                // Check to make sure the recipients email address is valid

                Parser::_validateEmail ($recipient['email']);

                // Send Mail From

                if (!$stream->Send ('MAIL FROM:' . $this->_fromAddress, '250'))
                {

                    // Add error and return FALSE

                    new \Sonic\Message ('error', 'MAIL FROM Failed: ' . $stream->getErrors (TRUE));
                    return FALSE;

                }

                // Send RCPT TO

                if (!$stream->Send ('RCPT TO:' . $recipient['email'], '250'))
                {

                    // Add error and return FALSE

                    new \Sonic\Message ('error', 'RCPT TO Failed: ' . $stream->getErrors (TRUE));
                    return FALSE;

                }

                // Send DATA

                if (!$stream->Send ('DATA', array ('250','354','451')))
                {

                    // Add error and return FALSE

                    new \Sonic\Message ('error', 'DATA Failed: ' . $stream->getErrors (TRUE));
                    return FALSE;

                }

                // Add recipient header to original headers

                if (isset($recipient['name'])) {
                    $toHeader = $recipient['name'] . '<' . $recipient['email'] . '>';
                } else {
                    $toHeader = $recipient['email'];
                }

                $emailHeaders	= $headers . 'To: ' . $toHeader . $this->_nl;

                // If we're using smarty

                if ($smarty)
                {

                    // Clear variables

                    $tpl->clearAllAssign ();

                    // Assign variables

                    $tpl->assign ('recipient', $recipient);

                    // Fetch

                    $emailMessage	= $tpl->fetch ('string:' . $this->_message);

                }

                // Else we're not using smarty

                else
                {

                    // Just leave the message as it is

                    $emailMessage	= $this->_message;

                }

                // Generate message to send

                $message	= array (
                    $emailHeaders,
                    '',
                    $emailMessage,
                    '',
                    '.'
                );

                // Send Message

                if (!$stream->Send ($message, '250'))
                {

                    // Add error and return FALSE

                    new \Sonic\Message ('error', 'DATA Failed: ' . $stream->getErrors (TRUE));
                    return FALSE;

                }

                if (is_callable($this->_callbackMethod)) {
                    call_user_func($this->_callbackMethod, $this->_subject, $recipient['email'], $this->_fromAddress, $emailMessage);
                }

                // If we're logging the email

                if ($this->logFlag)
                {

                    // Log

                    $this->Log ($recipient['email'], $emailHeaders, $emailMessage, 'stream');

                }

            }

                // Else the email address is not valid

            catch (Parser\Exception $e)
            {

                // Add error

                new \Sonic\Message ('error', 'Invalid recipient email address: ' . $recipient['email']);

                // Skip to next recipient

                continue;

            }

        }

        // If we're using smarty

        if ($smarty)
        {

            // Reset caching status

            $tpl->caching	= $smartyPrevCache;

        }

        // Send QUIT

        if (!$stream->Send ('QUIT'))
        {

            // Add error

            new \Sonic\Message ('error', 'QUIT Failed: ' . $stream->getErrors (TRUE));

        }

        // Return TRUE

        return TRUE;

    }
1076687
public function send($destination, $msg, array $header = [], $sync = null)
    {
        if (!$msg instanceof Frame) {
            return $this->send($destination, new Frame('SEND', $header, $msg), [], $sync);
        }

        $msg->addHeaders($header);
        $msg['destination'] = $destination;
        return $this->sendFrame($msg, $sync);
    }
574156
public function send($transporter='', $options=array())
	{
		$transporter = $transporter ? $transporter : \Config::get('mailer');

		if (is_object($transporter) && ($transporter instanceof \Swift_Transport))
		{
			// We were given a valid tranport mechanisms, so just use it
			$transport = $transporter;
		}
		elseif (is_string($transporter) && self::hasTrasporter($transporter))
		{
			$transport = self::getTrasporter($transporter);
		}
		else
		{
			switch (strtolower($transporter))
			{
				case 'smtp':
					if (!isset($options['host']))
					{
						$options['host'] = \Config::get('smtphost');
					}
					if (!isset($options['port']))
					{
						$options['port'] = \Config::get('smtpport');
					}
					if (!isset($options['username']))
					{
						$options['username'] = \Config::get('smtpuser');
					}
					if (!isset($options['password']))
					{
						$options['password'] = \Config::get('smtppass');
					}

					if (!empty($options))
					{
						$transport = \Swift_SmtpTransport::newInstance($options['host'], $options['port']);
						$transport->setUsername($options['username'])
						          ->setPassword($options['password']);
					}
				break;

				case 'sendmail':
					if (!isset($options['command']))
					{
						$options['command'] = '/usr/sbin/exim -bs';
					}
					$transport = \Swift_SendmailTransport::newInstance($options['command']);
				break;

				case 'mail':
				default:
					$transport = \Swift_MailTransport::newInstance();
					//set mail additional args (mail return path - used for bounces)
					//$transport->setExtraParams('-f hubmail-bounces@' . $_SERVER['HTTP_HOST']);
				break;
			}

			if (!($transport instanceof \Swift_Transport))
			{
				throw new \InvalidArgumentException('Invalid transport specified');
			}
		}

		$mailer = \Swift_Mailer::newInstance($transport);
		$result = $mailer->send($this, $this->_failures);

		if ($result)
		{
			\Log::info(sprintf('Mail sent to %s', json_encode($this->getTo())));
		}
		else
		{
			\Log::error(sprintf('Failed to mail %s', json_encode($this->getTo())));
		}

		return $result;
	}
1018379
public function getSet($set)
    {
        if (isset($this->sets[$set])) {
            return $this->sets[$set];
        }
        return null;
    }
870649
public function oneWayCall($name, $arguments = null)
    {
        Actor::call($this->actorName, $name, $arguments, true, $this->beginId);
    }
282069
public function __doRequestByCurl($request, $location, $action, $version, $one_way = FALSE)
	{
		// Call via Curl and use the timeout a
		$curl = curl_init($location);
		if ($curl === false) {
			throw new ClientException('Curl initialisation failed');
		}
		/** @var $headers array of headers to be sent with request */
		$headers = array(
			'User-Agent: PHP-SOAP',
			'Content-Type: text/xml; charset=utf-8',
			'SOAPAction: "' . $action . '"',
			'Content-Length: ' . strlen($request),
		);
		$options = array(
			CURLOPT_VERBOSE        => false,
			CURLOPT_RETURNTRANSFER => true,
			CURLOPT_POST           => true,
			CURLOPT_POSTFIELDS     => $request,
			CURLOPT_HEADER         => $headers,
			CURLOPT_HTTPHEADER     => array(sprintf('Content-Type: %s', $version == 2 ? 'application/soap+xml' : 'text/xml'), sprintf('SOAPAction: %s', $action)),
		);
		// Timeout in milliseconds
		$options = $this->__curlSetTimeoutOption($options, $this->timeout, 'CURLOPT_TIMEOUT');
		// ConnectTimeout in milliseconds
		$options = $this->__curlSetTimeoutOption($options, $this->connectTimeout, 'CURLOPT_CONNECTTIMEOUT');

		$this->__setCurlOptions($curl, $options);
		$response = curl_exec($curl);
		$this->lastResponse = $response;

		if (curl_errno($curl)) {
			$errorMessage = curl_error($curl);
			$errorNumber  = curl_errno($curl);
			curl_close($curl);
			throw new ClientException($errorMessage, $errorNumber);
		}

		$header_len = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
		$header = substr($response, 0, $header_len);
		$body = substr($response, $header_len);
		$this->lastResponseBody = $body;

		curl_close($curl);
		// Return?
		if ($one_way) {
			return null;
		} else {
			return $body;
		}
	}
91159
public function chatSend($sender, $receiver, $content, $type = 'text') {
        $result = $this->httpPost(self::WECHAT_CHAT_SEND_PREFIX, [
            'access_token' => $this->getAccessToken(),
            'receiver' => json_encode($receiver),
            'sender' => $sender,
            'msgtype' => $type,
            $type => json_encode($content),
        ]);
        return ($result['errmsg'] == 'ok') ? true : $result['errmsg'];
    }
10059
function sendToMultiple(send, msg, destinations, type) {
  destinations = destinations instanceof Array && destinations || [destinations];
  destinations.forEach(function(destination) {
    var set, socketIds;
    set = subscriptions[type];
    if ((socketIds = set.members(destination))) {
      return socketIds.slice(0).forEach(function(socketId) {
        if (!send.socketId(socketId, msg, destination)) {
          return set.removeFromAll(socketId);
        }
      });
    }
  });
  return true;
}
862647
function transmit(callback) {
  // Will call next(data, next)
  // Expect OUR next to be called with (err) so we know if it worked
  var iRes;
  var iReq;
  var msg = null;
  var outpacket = {
    responses: [],
    requests : []
  };

  if (typeof callback !== 'function') {
    callback = this.transmitter;
  }
  if (!this.active || typeof callback !== 'function') {
    return this;
  }

  iRes = this.outbox.responses.length;
  iReq = this.outbox.requests.length;
  if (
    iRes > 0
    && iReq > 0
    && 'system.extension.dual-batch' in this.remoteComponents
  ) {
    // Use dual-batch extension to send it all at once
    outpacket = msg = {
      responses: this.outbox.responses,
      requests : this.outbox.requests
    };
    // Setting length=0 would preserve references and we want to renew them
    this.outbox.responses = [];
    this.outbox.requests = [];
  } else if (iRes > 0) {
    // Responses have priority over requests
    if (iRes > 1) {
      outpacket.responses = msg = this.outbox.responses;
      this.outbox.responses = [];
    } else {
      outpacket.responses.push(msg = this.outbox.responses.pop());
    }
  } else if (iReq > 0) {
    if (iReq > 1) {
      outpacket.requests = msg = this.outbox.requests;
      this.outbox.requests = [];
    } else {
      outpacket.requests.push(msg = this.outbox.requests.pop());
    }
  } else {
    return this;
  }

  // Send msg using callback
  setImmediate(
    callback,
    JSON.stringify(msg),
    confirmTransmit.bind(this, outpacket)
  );

  return this;
}
204167
function send($data)
    {
        $len = strlen($data);
        $n = socket_sendto($this->sock, $data, $len, 0, $this->host, $this->port);

        if ($n === false or $n < $len) {
            $this->set_error();
            return false;
        } else {
            return $n;
        }
    }
1333842
public function updateWithTransport($transport)
    {
        /** @noinspection PhpUndefinedMethodInspection */
        /** @noinspection PhpUndefinedMethodInspection */
        $this
            ->setSubject($transport->getMessage()->getSubject())
            ->setMessage($transport->getMessage())
            ->setRecipients($transport->getMessage()->getRecipients())
            ->setId(null);

        return $this;
    }
965356
public function open( $set = null )
    {
        return $this->setting(
            'open',
            null === $set ? null : (bool) $set
        );
    }
916928
public function send(
        $from_name,
        array $receivers,
        &$successfulRecipients,
        &$failedRecipients,
        $subject = '',
        $body = '',
        $content_type = 'text/html',
        $charset = 'UTF-8'
    )
    {
        $mailer = \Swift_Mailer::newInstance($this->transport);
        $message = \Swift_Message::newInstance();
        $message->setFrom([$this->_username => $from_name]);
        $message->setTo($receivers);
        $message->setSubject($subject);
        $message->setBody($body, $content_type, $charset);
        $successfulRecipients = $mailer->send($message, $failedRecipients);
        return true;
    }