sendPacket
@param  object $pct [@todo description]
@param  callable $cb [@todo description]
@callback $cb ( )
@return void
515154
public function sendPacket($pct, $cb = null)
    {
        if (sizeof($this->framesBuffer)) {
            $this->buffer[] = 'a' . $this->toJson($this->framesBuffer);
            $this->framesBuffer = [];
        }
        $this->buffer[] = $pct;
        if ($cb !== null) {
            $this->onWrite->push($cb);
        }
        $this->flush();
    }
600218
public void sendClosePacket(String cmd, String nodeID, Context ctx, long sequence) {
		FastBuildTree msg = new FastBuildTree(7);

		// Add required properties (version, sender's nodeID, request ID)
		msg.putUnsafe("ver", PROTOCOL_VERSION);
		msg.putUnsafe("sender", this.nodeID);
		msg.putUnsafe("id", ctx.id);
		msg.putUnsafe("success", true);
		msg.putUnsafe("meta", Collections.EMPTY_MAP);
		
		// Stream packet counter (1...N)
		msg.putUnsafe("seq", sequence);

		// End of streaming
		msg.putUnsafe("stream", false);

		// Send message
		publish(cmd, nodeID, msg);
	}
1299333
public function send($from, $to, $subject, $text, $files = [], $bcc = null)
    {
        $files = $files === null ? [] : $files;

        return $this->transports[$this->defaultTransport]->send($from, $to, $subject, $text, $files, $bcc);
    }
624726
public function sendFrame($data, $type = null, $cb = null)
    {
        if (!$this->handshaked) {
            return false;
        }

        if ($this->finished && $type !== 'CONNCLOSE') {
            return false;
        }

        /*if (in_array($type, ['STRING', 'BINARY']) && ($this->outgoingCompression > 0) && in_array('deflate-frame', $this->extensions)) {
            //$data = gzcompress($data, $this->outgoingCompression);
            //$rsv1 = 1;
        }*/

        $fin = 1;
        $rsv1 = 0;
        $rsv2 = 0;
        $rsv3 = 0;
        $this->write(
            chr(
                bindec(
                    $fin . $rsv1 . $rsv2 . $rsv3
                    . str_pad(
                        decbin(
                            $this->getFrameType($type)
                        ),
                        4,
                        '0',
                        STR_PAD_LEFT
                    )
                )
            )
        );
        $dataLength = mb_orig_strlen($data);
        $isMasked = false;
        $isMaskedInt = $isMasked ? 128 : 0;
        if ($dataLength <= 125) {
            $this->write(chr($dataLength + $isMaskedInt));
        } elseif ($dataLength <= 65535) {
            $this->write(chr(126 + $isMaskedInt) . // 126 + 128
                chr($dataLength >> 8) .
                chr($dataLength & 0xFF));
        } else {
            $this->write(chr(127 + $isMaskedInt) . // 127 + 128
                chr($dataLength >> 56) .
                chr($dataLength >> 48) .
                chr($dataLength >> 40) .
                chr($dataLength >> 32) .
                chr($dataLength >> 24) .
                chr($dataLength >> 16) .
                chr($dataLength >> 8) .
                chr($dataLength & 0xFF));
        }
        if ($isMasked) {
            $mask = chr(mt_rand(0, 0xFF)) .
                chr(mt_rand(0, 0xFF)) .
                chr(mt_rand(0, 0xFF)) .
                chr(mt_rand(0, 0xFF));
            $this->write($mask . $this->mask($data, $mask));
        } else {
            $this->write($data);
        }
        if ($cb !== null) {
            $this->onWriteOnce($cb);
        }
        return true;
    }
447202
protected function _send()
	{
		$message = $this->build_message(true);

		if(empty($this->config['smtp']['host']) or empty($this->config['smtp']['port']))
		{
			throw new \FuelException('Must supply a SMTP host and port, none given.');
		}

		// Use authentication?
		$authenticate = (empty($this->smtp_connection) and ! empty($this->config['smtp']['username']) and ! empty($this->config['smtp']['password']));

		// Connect
		$this->smtp_connect();

		// Authenticate when needed
		$authenticate and $this->smtp_authenticate();

		// Set from
		$this->smtp_send('MAIL FROM:<'.$this->config['from']['email'].'>', 250);

		foreach(array('to', 'cc', 'bcc') as $list)
		{
			foreach($this->{$list} as $recipient)
			{
				$this->smtp_send('RCPT TO:<'.$recipient['email'].'>', array(250, 251));
			}
		}

		// Prepare for data sending
		$this->smtp_send('DATA', 354);

		$lines = explode($this->config['newline'], $message['header'].preg_replace('/^\./m', '..$1', $message['body']));

		foreach($lines as $line)
		{
			if(substr($line, 0, 1) === '.')
			{
				$line = '.'.$line;
			}

			fputs($this->smtp_connection, $line.$this->config['newline']);
		}

		// Finish the message
		$this->smtp_send('.', 250);

		// Close the connection if we're not using pipelining
		$this->pipelining or $this->smtp_disconnect();

		return true;
	}
343518
public function send(Message $mail): void
    {
        $tmp = clone $mail;
        $tmp->setHeader('Bcc', null);
        $data = $tmp->generateMessage();

        try {
            if (!$this->connection) {
                $this->connect();
            }

            if (
                ($from = $mail->getHeader('Return-Path'))
                || ($from = \array_keys((array) $mail->getHeader('From'))[0])
            ) {
                $this->write("MAIL FROM:<$from>", 250);
            }

            foreach (\array_merge(
                         (array) $mail->getHeader('To'),
                         (array) $mail->getHeader('Cc'),
                         (array) $mail->getHeader('Bcc')
                     ) as $email => $name) {
                $this->write("RCPT TO:<$email>", [250, 251]);
            }

            $this->write('DATA', 354);
            $data = \preg_replace('#^\.#m', '..', $data);
            $this->write($data);
            $this->write('.', 250);

            if (!$this->persistent) {
                $this->write('QUIT', 221);
                $this->disconnect();
            }
        } catch (SmtpException $e) {
            if ($this->connection) {
                $this->disconnect();
            }
            throw $e;
        }
    }
414435
public function send()
    {
        $data = $this->parseDataToString($this->data);
        $format = $this->allowedFormats[$this->format];

        // Send status header
        header($this->getStatus(), true, $this->getStatus());

        foreach(self::$headers as $key => $value) {
            header($key.": ".$value);
        }

        // Send content type header
        header("Content-Type: ".$format['mimetype']."; charset=utf-8");

		// Set content length header
		header("Content-Length: ".strlen($data));

        if(function_exists("ginger_log")) {
            ginger_log($this);
        }

        echo $data;

        die();
    }
291275
public function sendPing($host, $cb)
    {
        $this->connect('raw://' . $host, function ($conn) use ($cb) {
            $conn->sendEcho($cb);
        });
    }
1153790
public function rcpt($to)
    {
        if ($this->_mail == false) {
            throw new SMTPException(__('Must call MAIL before calling RCPT'));
        }

        $this->_send('RCPT TO:<' . $to . '>');
        $this->_expect(array(250, 251), 300);

        $this->_rcpt = true;
    }
45827
async def send(self, pkt):
        """"""
        if not await self.check_ping_timeout():
            return
        if self.upgrading:
            self.packet_backlog.append(pkt)
        else:
            await self.queue.put(pkt)
        self.server.logger.info('%s: Sending packet %s data %s',
                                self.sid, packet.packet_names[pkt.packet_type],
                                pkt.data if not isinstance(pkt.data, bytes)
                                else '<binary>')
1222951
public function send(string $protocol)
    {
        header("$protocol {$this->statusCode} {$this->statusText}");
        foreach ($this->headers->getStringifiedArray() as $header) {
            header($header);
        }

        echo $this->body;
    }
1199664
public function send(): void
	{
		if (count($this->recipients) === 0) {
			throw new NoRecipientException();
		}
		if ($this->loader !== null) {
			$this->latte->setLoader($this->loader);
			$body = $this->latte->renderToString($this->template, $this->variables);
		} else {
			$body = $this->latte->renderToString($this->basePath . $this->template . '.latte', $this->variables);
		}

		$this->message->setHtmlBody($body, $this->imagePath);
		$this->mailer->send($this->message);

		$this->onSend();
	}
341030
public function onUdpPacket($pct)
    {
        if (mb_orig_strlen($pct) < 10) {
            return;
        }
        $orig = $pct;
        $this->response = [];
        Binary::getWord($pct); // ID
        $bitmap = Binary::getBitmap(Binary::getByte($pct)) . Binary::getBitmap(Binary::getByte($pct));
        //$qr = (int) $bitmap[0];
        $opcode = bindec(substr($bitmap, 1, 4));
        //$aa = (int) $bitmap[5];
        //$tc = (int) $bitmap[6];
        //$rd = (int) $bitmap[7];
        //$ra = (int) $bitmap[8];
        //$z = bindec(substr($bitmap, 9, 3));
        $rcode = bindec(mb_orig_substr($bitmap, 12));
        $this->response['status'] = [
            'rcode' => $rcode,
            'msg' => $this->getMessageByRcode($rcode)
        ];
        $qdcount = Binary::getWord($pct);
        $ancount = Binary::getWord($pct);
        $nscount = Binary::getWord($pct);
        $arcount = Binary::getWord($pct);
        for ($i = 0; $i < $qdcount; ++$i) {
            $name = Binary::parseLabels($pct, $orig);
            $typeInt = Binary::getWord($pct);
            $type = isset(Pool::$type[$typeInt]) ? Pool::$type[$typeInt] : 'UNK(' . $typeInt . ')';
            $classInt = Binary::getWord($pct);
            $class = isset(Pool::$class[$classInt]) ? Pool::$class[$classInt] : 'UNK(' . $classInt . ')';
            if (!isset($this->response[$type])) {
                $this->response[$type] = [];
            }
            $record = [
                'name' => $name,
                'type' => $type,
                'class' => $class,
            ];
            $this->response['query'][] = $record;
        }
        $getResRecord = function (&$pct) use ($orig) {
            $name = Binary::parseLabels($pct, $orig);
            $typeInt = Binary::getWord($pct);
            $type = isset(Pool::$type[$typeInt]) ? Pool::$type[$typeInt] : 'UNK(' . $typeInt . ')';
            $classInt = Binary::getWord($pct);
            $class = isset(Pool::$class[$classInt]) ? Pool::$class[$classInt] : 'UNK(' . $classInt . ')';
            $ttl = Binary::getDWord($pct);
            $length = Binary::getWord($pct);
            $data = mb_orig_substr($pct, 0, $length);
            $pct = mb_orig_substr($pct, $length);

            $record = [
                'name' => $name,
                'type' => $type,
                'class' => $class,
                'ttl' => $ttl,
            ];

            if (($type === 'A') || ($type === 'AAAA')) {
                if ($data === "\x00") {
                    $record['ip'] = false;
                    $record['ttl'] = 5;
                } else {
                    $record['ip'] = inet_ntop($data);
                }
            } elseif ($type === 'NS') {
                $record['ns'] = Binary::parseLabels($data, $orig);
            } elseif ($type === 'CNAME') {
                $record['cname'] = Binary::parseLabels($data, $orig);
            } elseif ($type === 'SOA') {
                $record['mname'] = Binary::parseLabels($data, $orig);
                $record['rname'] = Binary::parseLabels($data, $orig);
                $record['serial'] = Binary::getDWord($data);
                $record['refresh'] = Binary::getDWord($data);
                $record['retry'] = Binary::getDWord($data);
                $record['expire'] = Binary::getDWord($data);
                $record['nx'] = Binary::getDWord($data);
            } elseif ($type === 'MX') {
                $record['preference'] = Binary::getWord($data);
                $record['exchange'] = Binary::parseLabels($data, $orig);
            } elseif ($type === 'TXT') {
                $record['text'] = '';
                $lastLength = -1;
                while (($length = mb_orig_strlen($data)) > 0 && ($length !== $lastLength)) {
                    $record['text'] .= Binary::parseLabels($data, $orig);
                    $lastLength = $length;
                }
            } elseif ($type === 'SRV') {
                $record['priority'] = Binary::getWord($data);
                $record['weight'] = Binary::getWord($data);
                $record['port'] = Binary::getWord($data);
                $record['target'] = Binary::parseLabels($data, $orig);
            }

            return $record;
        };
        for ($i = 0; $i < $ancount; ++$i) {
            $record = $getResRecord($pct);
            if (!isset($this->response[$record['type']])) {
                $this->response[$record['type']] = [];
            }
            $this->response[$record['type']][] = $record;
        }
        for ($i = 0; $i < $nscount; ++$i) {
            $record = $getResRecord($pct);
            if (!isset($this->response[$record['type']])) {
                $this->response[$record['type']] = [];
            }
            $this->response[$record['type']][] = $record;
        }
        for ($i = 0; $i < $arcount; ++$i) {
            $record = $getResRecord($pct);
            if (!isset($this->response[$record['type']])) {
                $this->response[$record['type']] = [];
            }
            $this->response[$record['type']][] = $record;
        }
        $this->onResponse->executeOne($this->response);
        if (!$this->keepalive) {
            $this->finish();
            return;
        } else {
            $this->checkFree();
        }
    }
100518
function send_commands(cmds, cb) {
        function callback(value) {
            if (cb) cb(value)
            this.locked = false
        }
        function run() { 
            if (this.locked = cmds.length > 0) send_command(cmds.shift(), (success) => {
                if (success) setTimeout(run, 200);
                else callback(false);
            });
            else callback(true); 
        };
        if(!this.locked) run();
    }
286850
public function command($cmd, $q = '', $cb = null)
    {
        if ($this->state !== self::STATE_AUTH_OK) {
            return false;
        }

        $this->sendPacket($cmd, $q);

        $this->onResponse->push($cb);
        $this->checkFree();

        return true;
    }
500786
public function send()
    {
        foreach ($this->headers as $header) {
            header($header->getString(), $header->getReplace(), $header->getHttpResponseCode());
        }
    }
402854
public function sendCommand($commandName, $payload, $cb = null)
    {

        $pct = implode(
            static::ARGS_DELIMITER,
            array_map(function ($item) {
                return !is_scalar($item) ? serialize($item) : $item;
            }, (array)$payload)
        );
        $this->onResponse->push($cb);
        $this->write(
            pack(
                static::HEADER_WRITE_FORMAT,
                static::MAGIC_REQUEST,
                $this->requestCommandList[$commandName],
                mb_orig_strlen($pct)
            )
        );
        $this->write($pct);
    }