phpseclib\Net\SSH2::_send_channel_packet PHP Метод

_send_channel_packet() публичный Метод

Spans multiple SSH_MSG_CHANNEL_DATAs if appropriate
public _send_channel_packet ( integer $client_channel, string $data ) : boolean
$client_channel integer
$data string
Результат boolean
    function _send_channel_packet($client_channel, $data)
    {
        while (strlen($data)) {
            if (!$this->window_size_client_to_server[$client_channel]) {
                $this->bitmap ^= self::MASK_WINDOW_ADJUST;
                // using an invalid channel will let the buffers be built up for the valid channels
                $this->_get_channel_packet(-1);
                $this->bitmap ^= self::MASK_WINDOW_ADJUST;
            }
            /* The maximum amount of data allowed is determined by the maximum
               packet size for the channel, and the current window size, whichever
               is smaller.
                 -- http://tools.ietf.org/html/rfc4254#section-5.2 */
            $max_size = min($this->packet_size_client_to_server[$client_channel], $this->window_size_client_to_server[$client_channel]);
            $temp = Strings::shift($data, $max_size);
            $packet = pack('CN2a*', NET_SSH2_MSG_CHANNEL_DATA, $this->server_channels[$client_channel], strlen($temp), $temp);
            $this->window_size_client_to_server[$client_channel] -= strlen($temp);
            if (!$this->_send_binary_packet($packet)) {
                return false;
            }
        }
        return true;
    }