Package libssh2 :: Module channel :: Class Channel
[frames] | no frames]

Class Channel

source code

object --+
         |
        Channel

Channel object

Instance Methods
 
__init__(self, _channel)
Creates a new channel object with the given _channel.
source code
int
close(self)
Closes the active channel.
source code
int
eof(self)
Checks if the remote host has sent a EOF status.
source code
int
execute(self, command)
Executes command on the channel.
source code
int
exit_status(self)
Gets the exit code raised by the process running on the remote host.
source code
int
flush(self)
Flushs the read buffer on the channel.
source code
int
poll(self, timeout, nfds)
Polls for activity on the channel.
source code
int
poll_read(self, extended)
Checks if data is available on the channel.
source code
int
pty(self, term="vt100")
Requests a pty with term type on the channel.
source code
int
pty_resize(self, width, height)
Requests a pty resize of the channel with given width and height.
source code
str
read(self, size=4096)
Reads size bytes on the channel.
source code
int
send_eof(self)
Sends EOF status on the channel to remote server.
source code
int
setblocking(self, mode=1)
Sets blocking mode on the channel.
source code
int
setenv(self, name, value)
Sets envrionment variable on the channel.
source code
int
shell(self)
Requests a shell on the channel.
source code
int
window_read(self, read_avail, window_size_initial)
Checks the status of the read window on the channel.
source code
int
write(self, message)
Writes data on the channel.
source code
int
x11_req(self, display)
Requests a X11 Forwarding on the channel.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties

Inherited from object: __class__

Method Details

__init__(self, _channel)
(Constructor)

source code 

Creates a new channel object with the given _channel.

Parameters:
Overrides: object.__init__

close(self)

source code 

Closes the active channel.

Returns: int
0 on success or negative on failure

eof(self)

source code 

Checks if the remote host has sent a EOF status.

Returns: int
1 if the remote host has sent EOF otherwise 0

execute(self, command)

source code 

Executes command on the channel.

Parameters:
  • command (str) - message data
Returns: int
0 on success or negative on failure

exit_status(self)

source code 

Gets the exit code raised by the process running on the remote host.

Returns: int
the exit status reported by remote host or 0 on failure

flush(self)

source code 

Flushs the read buffer on the channel.

Returns: int
0 on sucess or negative on failure

poll(self, timeout, nfds)

source code 

Polls for activity on the channel.

Parameters:
  • timeout (int) - remaining timeout
  • nfds (int) - number of fds to poll
Returns: int
number of fds with interesting events or negative on failure

poll_read(self, extended)

source code 

Checks if data is available on the channel.

Parameters:
  • extended (int) - if message channel datas is extended
Returns: int
1 when data is available or 0 otherwise

pty(self, term="vt100")

source code 

Requests a pty with term type on the channel.

Parameters:
  • term (str) - terminal emulation type (vt100, ansi, etc...)
Returns: int
0 on success or negative on failure

pty_resize(self, width, height)

source code 

Requests a pty resize of the channel with given width and height.

Parameters:
  • width (int) - terminal width
  • height (int) - terminal height
Returns: int
0 on success or negative on failure

read(self, size=4096)

source code 

Reads size bytes on the channel.

Parameters:
  • size (int) - size of the buffer storage
Returns: str
bytes readed or negative on failure

send_eof(self)

source code 

Sends EOF status on the channel to remote server.

Returns: int
0 on success or negative on failure

setblocking(self, mode=1)

source code 

Sets blocking mode on the channel. Default mode is blocking.

Parameters:
  • mode - blocking (1) or non blocking (0) mode
Returns: int

setenv(self, name, value)

source code 

Sets envrionment variable on the channel.

Parameters:
  • name (str) - envrionment variable name
  • value (str) - envrionment variable value
Returns: int
0 on success or negative on failure

shell(self)

source code 

Requests a shell on the channel.

Returns: int
0 on success or negative on failure

window_read(self, read_avail, window_size_initial)

source code 

Checks the status of the read window on the channel.

Parameters:
  • read_avail (int) - window limit to read
  • window_size_initial (int) - window initial size defined
Returns: int
the number of bytes which the remote end may send without overflowing the window limit

write(self, message)

source code 

Writes data on the channel.

Parameters:
  • message (str) - data to write
Returns: int
0 on sucess or failure

x11_req(self, display)

source code 

Requests a X11 Forwarding on the channel.

Parameters:
  • display - screen number
  • display - int
Returns: int
0 on success or negative on failure