Sends the stream.
423817
protected function flow(): void
	{
		// Erase output buffers and disable output buffering

		while(ob_get_level() > 0) ob_end_clean();

		// Send the stream

		$stream = $this->stream;

		$stream($this);

		// Send empty chunk to tell the client that we're done

		$this->flush(null, true);
	}
796244
public function send()
    {
        $this->sendHeader();

        $body = $this->getBody();

        $body->rewind();

        echo $body->getContents();
    }
668896
public void sendData() throws IOException {
        if (_writer != null) {
            _writer.write(_buffer.toString());
            _writer.flush();
            _buffer = new StringBuffer();
        }
    }
138112
def send(frame)
      if Frame::Data === frame
        @send_buffer << frame
        if @send_remaining_window < frame.length
          if Stream === self
            connection.callback(:send_deferred, self, frame)
          else
            callback(:send_deferred, self, frame)
          end
        else
          consume_send_buffer
        end
      else
        send_immediately frame
      end
    end
1321310
public function send() {
        if (!$this->sent) {
            $this->sendConfig();
            $this->sendHeaders();
            $this->sendContent();
            $this->sent = true;
        }
    }
414067
public function send(): void
	{
		if($this->body instanceof ResponseSenderInterface)
		{
			// This is a response sender so we'll just pass it the
			// request and response instances and let it handle the rest itself

			$this->body->send($this->request, $this);
		}
		else
		{
			if($this->body instanceof ResponseBuilderInterface)
			{
				$this->body->build($this->request, $this);
			}

			$sendBody = true;

			// Make sure that output buffering is enabled

			if(ob_get_level() === 0)
			{
				ob_start();
			}

			// Cast body to string in case it's an obect implementing __toString

			$this->body = (string) $this->body;

			// Check ETag if response cache is enabled

			if($this->responseCache === true)
			{
				$hash = '"' . hash('sha256', $this->body) . '"';

				$this->headers->add('ETag', $hash);

				if(str_replace('-gzip', '', $this->request->getHeaders()->get('If-None-Match')) === $hash)
				{
					$this->setStatus(304);

					$sendBody = false;
				}
			}

			if($sendBody && !in_array($this->statusCode, [100, 101, 102, 204, 304]))
			{
				// Start compressed output buffering if output compression is enabled

				if($this->outputCompression)
				{
					ob_start('ob_gzhandler');
				}

				echo $this->body;

				// If output compression is enabled then we'll have to flush the compressed buffer
				// so that we can get the compressed content length when setting the content-length header

				if($this->outputCompression)
				{
					ob_end_flush();
				}

				// Add the content-length header

				if(!$this->headers->has('Transfer-Encoding'))
				{
					$this->headers->add('Content-Length', ob_get_length());
				}
			}

			// Send the headers and flush the output buffer

			$this->sendHeaders();

			ob_end_flush();
		}
	}
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;

    }
1136735
@Override
  public void deliver(WriteStream os, OutHttp2 outHttp)
    throws IOException
  {
    outHttp.writePriority(_streamId, _streamRef, _weight);
  }
570891
public function sendContent()
    {
        if (null === $this->callback) {
            throw new \LogicException('The SteamedResponse callback must not be null.');
        }

        if (!$this->streamed && $this->callback !== null) {
            call_user_func($this->callback);
            $this->streamed = true;
        }
    }
1155075
public void sendfile(OutputStream os, long offset, long length)
    throws IOException
  {
    if (os instanceof OutputStreamWithBuffer) {
      writeToStream((OutputStreamWithBuffer) os);
    }
    else {
      writeToStream(os);
    }
  }
1190464
public void sendStream(InputStream inStream, int remaining) throws IOException {
    int expectedLength = remaining;
    if (streamBuffer == null) {
      streamBuffer = new byte[8192];
    }

    while (remaining > 0) {
      int count = (remaining > streamBuffer.length ? streamBuffer.length : remaining);
      int readCount;

      try {
        readCount = inStream.read(streamBuffer, 0, count);
        if (readCount < 0) {
          throw new EOFException(
              GT.tr("Premature end of input stream, expected {0} bytes, but only read {1}.",
                  expectedLength, expectedLength - remaining));
        }
      } catch (IOException ioe) {
        while (remaining > 0) {
          send(streamBuffer, count);
          remaining -= count;
          count = (remaining > streamBuffer.length ? streamBuffer.length : remaining);
        }
        throw new PGBindException(ioe);
      }

      send(streamBuffer, readCount);
      remaining -= readCount;
    }
  }
783420
def send(self, data: bytes = b""):
        
        self.input.extend(data)
        self._process()
458498
async def _send(self, stream_id, pp_id, user_data,
                    expiry=None, max_retransmits=None, ordered=True):
        
        if ordered:
            stream_seq = self._outbound_stream_seq.get(stream_id, 0)
        else:
            stream_seq = 0

        fragments = math.ceil(len(user_data) / USERDATA_MAX_LENGTH)
        pos = 0
        for fragment in range(0, fragments):
            chunk = DataChunk()
            chunk.flags = 0
            if not ordered:
                chunk.flags = SCTP_DATA_UNORDERED
            if fragment == 0:
                chunk.flags |= SCTP_DATA_FIRST_FRAG
            if fragment == fragments - 1:
                chunk.flags |= SCTP_DATA_LAST_FRAG
            chunk.tsn = self._local_tsn
            chunk.stream_id = stream_id
            chunk.stream_seq = stream_seq
            chunk.protocol = pp_id
            chunk.user_data = user_data[pos:pos + USERDATA_MAX_LENGTH]

            # initialize counters
            chunk._abandoned = False
            chunk._acked = False
            chunk._book_size = len(chunk.user_data)
            chunk._expiry = expiry
            chunk._max_retransmits = max_retransmits
            chunk._misses = 0
            chunk._retransmit = False
            chunk._sent_count = 0
            chunk._sent_time = None

            pos += USERDATA_MAX_LENGTH
            self._local_tsn = tsn_plus_one(self._local_tsn)
            self._outbound_queue.append(chunk)

        if ordered:
            self._outbound_stream_seq[stream_id] = uint16_add(stream_seq, 1)

        # transmit outbound data
        if not self._t3_handle:
            await self._transmit()
594257
protected void sendMessage(DataOutputStream outputStream, Message message) throws IOException {
        long startNs = System.nanoTime();
        ProtoUtils.writeMessage(outputStream, message);
        if(streamStats != null) {
            streamStats.reportNetworkTime(operation,
                                          Utils.elapsedTimeNs(startNs, System.nanoTime()));
        }
    }
1063391
@Override
  public void offerData(OutputStream stream) {
    byte[] next = null;
    try {
      next = queue.poll(timeoutMillis, TimeUnit.MILLISECONDS);
    } catch (InterruptedException ignored) {
      // If this ever times out (unlikely given our assumption), next stays null.
    }

    try {
      // Only if next is not null nor CLOSED do we write the chunk.
      if (next != null && next != CLOSED) {
        stream.write(next);
        return;
      }
    } catch (IOException ignored) {
      // Any errors in the piped (NS)OutputStream (unlikely) fall through to the next section.
    }

    // Close the piped (NS)OutputStream and ignore any errors.
    try {
      stream.close();
    } catch (IOException ignored) {
      // Ignored.
    }
  }
1066321
def send(self, data):
        """"""
        bytes_sent = self._sock.send(extract_bytes(data))
        self.bytes_written += bytes_sent
        return bytes_sent
1077827
protected function sendContent()
    {
        $illuminateResponse = $this->getIlluminateResponse();

        if ($illuminateResponse instanceof StreamedResponse && property_exists($illuminateResponse, 'output')) {
            // TODO Add Streamed Response with output
            $this->swooleResponse->end($illuminateResponse->output);
        } elseif ($illuminateResponse instanceof BinaryFileResponse) {
            $this->swooleResponse->sendfile($illuminateResponse->getFile()->getPathname());
        } else {
            $this->sendInChunk($illuminateResponse->getContent());
        }
    }