Class: Net::SSH::Connection::Channel

Class | Net::SSH::Connection::Channel
In: | lib/net/ssh/connection/channel.rb
Parent: | Object

### Methods

[] []= close create do_confirm_failed do_confirm_open do_data do_extended_data do_window_adjust event exec new on_close on_confirm_failed on_confirm_open on_data on_eof on_extended_data on_failure on_request on_success on_window_adjust open property request_pty send_data send_data_packet send_eof send_extended_data send_extended_data_packet send_request send_request_string send_signal send_window_adjust set_property subsystem valid?

### Included Modules

Constants

### Constants

VALID_PTY_OPTIONS | = | { :term=>"xterm", :chars_wide=>80, :chars_high=>24, :pixels_wide=>640, :pixels_high=>480, :modes=>{}, :want_reply=>false }

### Attributes

connection | [R] | The connection driver instance that owns this channel
local_id | [R] | The channel‘s local id (assigned by the connection)
local_maximum_packet_size | [R] | The maximum packet size that may be sent over this channel
local_window_size | [R] | The maximum data window size for this channel
maximum_packet_size | [R] | The maximum packet size that may be sent over this channel
remote_id | [R] | The channel‘s remote id (assigned by the remote server)
type | [R] | The type of this channel
window_size | [R] | The maximum data window size for this channel

### Public Class methods

create( connection, log, buffers, type, remote_id, window_size, packet_size )

Creates a new channel object with the given internal information. The channel is assumed to already be connected to a remote host.

event( event, *parameters )

A convenience method for defining new event callbacks.

new( connection, log, buffers, type )

Create a new channel object on the given connection, and of the given type.

open( connection, log, buffers, type, data=nil )

Requests that a new channel be opened on the remote host. This will return immediately, but the `on_confirm_open` callback will be invoked when the remote host confirms that the channel has been successfully opened.

### Public Instance methods

[]( name )

Alias for property

[]=( name, value )

Alias for set_property

close( client_initiated=true )

Closes the channel.

do_confirm_failed( reason_code, description, language )

Invoked when the server failed to confirm the opening of a channel.

do_confirm_open( remote_id, window_size, packet_size )

Invoked when the server confirms the opening of a channel.

do_data( data )

Invoked when the server sends a data packet. This in turn calls the "on_data" callback.

do_extended_data( type, data )

Invoked when the server sends an extended data packet. This in turn calls the "on_extended_data" callback.

do_window_adjust( bytes_to_add )

Invoked when the server asks to adjust the window size. This in turn calls the "on_window_adjust" callback.

exec( command, want_reply=false )

Execute the given remote command over the channel. This should be invoked in the "on_confirm" callback of a channel. This method will return immediately.

on_close( &block )

Set the callback to be invoked when the channel is closed.

on_confirm_failed( &block )

Set the callback to use when the channel could not be opened for some reason.

on_confirm_open( &block )

Set the callback to use when the channel has been confirmed to be open.

on_data( &block )

Set the callback to be invoked when the server sends a data packet over the channel.

on_eof( &block )

Set the callback to be invoked when the server sends an EOF packet.

on_extended_data( &block )

Set the callback to be invoked when the server sends an extended data packet over the channel.

on_failure( &block )

Set the callback to invoked when the server sends notification of a failed operation.

on_request( &block )

Set the callback to be invoked when the server sends a request packet.

on_success( &block )

Set the callback to invoked when the server sends confirmation of a successful operation.

on_window_adjust( &block )

Set the callback to be invoked when the server requests that the window size be adjusted.

property( name )

Retrieved a named property of the channel.

request_pty( opts = {} )

Request that a pty be opened for this channel. Valid options are :term, :chars_wide, :chars_high, :pixels_wide, :pixels_high, :modes, and :want_reply. :modes is a Hash, where the keys are constants from Net::SSH::Service::Term, and values are integers describing the corresponding key.

send_data( data )

Send a data packet to the server, over the channel.

send_data_packet( data )

Send a data packet to the server, over the channel. Only sends as much of that data as the channel is currently capable of sending (based on window size and maximum packet size), and returns any data that could not be sent. Returns `nil` if all the data that was requested to be sent, was sent.

send_eof()

Send an EOF across the channel. No data should be sent from the client to the server over this channel after this, although packets may still be received from the server.

send_extended_data( type, data )

Send an extended data packet to the server, over the channel. Extended data always has a numeric type associated with it. The only predefined type is 1, whic corresponds to `stderr` data.

send_extended_data_packet( type, data )

Send an extended data packet to the server, over the channel. Extended data always has a numeric type associated with it. The only predefined type is 1, whic corresponds to `stderr` data.

send_request( request_name, data, want_reply=false )

Send a generic channel request with the given name. The data item will be written directly into the request (after converting it to a string, as necessary).

send_request_string( request_name, data, want_reply=false )

Send a channel request with the given name. It will have one data item, which will be interpreted as a string.

send_signal( sig, want_reply=false )

Send the given signal to process on the other side of the channel. The parameter should be one of the Channel::SIGxxx constants.

send_window_adjust( size )

Send a "window adjust" message to the server for this channel, informing it that it may send this many more bytes over the channel.

set_property( name, value )

Set a named property on the channel.

subsystem( subsystem, want_reply=true )

Request the given subsystem. This method will return immediately.

valid?()

[Validate]