- setenv ( key, value ... )
- blocking ( flag )
- pty ( terminal [, modes [, width [, height ]]] )
- pty_size ( width, height )
- process ( request, message )
- exec ( command )
- subsystem ( name )
- ext_data ( mode )
- read ( buffer, size [, ext ] )
- write ( buffer [, ext ] )
- flush ( [ ext ] )
- receive_window_adjust (adjustment [, force])
- SEE ALSO
- COPYRIGHT AND LICENSE
Net::SSH2::Channel - SSH 2 channel object
A channel object is created by the Net::SSH2
channel method. As well as being an object, it is also a tied filehandle. The Net::SSH2
poll method can be used to check for read/write availability and other conditions.
setenv ( key, value ... )
Sets remote environment variables. Note that most implementations do not allow environment variables to be freely set. Pass in a list of keys and values with the values to set. Returns the number of successful sets.
blocking ( flag )
Enable or disable blocking. Note that this is currently implemented in libssh2 by setting a per-session flag; it's equivalent to Net::SSH2::blocking.
Returns true if the remote server sent an EOF.
Send an EOF to the remote. After an EOF has been sent, no more data may be sent; the connection should be closed.
Close the channel (happens automatically on object destruction).
Wait for a remote close event. Must have already seen remote EOF.
Returns the channel's program exit status.
pty ( terminal [, modes [, width [, height ]]] )
Request a terminal on a channel. If provided,
height are the width and height in characters (defaults to 80x24); if negative their absolute values specify width and height in pixels.
pty_size ( width, height )
Request a terminal size change on a channel.
height are the width and height in characters; if negative their absolute values specify width and height in pixels.
process ( request, message )
Start a shell on the remote host; calls process("shell").
exec ( command )
Execute the command on the remote host; calls process("exec", command). Note that only one of these requests can succeed per channel (cp. "exec" in perlfunc); if you want to run a series of commands, consider using shell instead.
subsystem ( name )
Run subsystem on the remote host; calls process("subsystem", command).
ext_data ( mode )
Set extended data handling mode:
- normal (default)
Keep data in separate channels; stderr is read separately.
Ignore all extended data.
Merge into the regular channel.
read ( buffer, size [, ext ] )
Attempts to read size bytes into the buffer. Returns number of bytes read, undef on failure. If ext is present and set, reads from the extended data channel (stderr).
write ( buffer [, ext ] )
Attempts to write the buffer to the channel. Returns number of bytes written, undef on failure. If ext is present and set, writes to the extended data channel (stderr).
In case the write operation would block and non-blocking mode is active then it returns LIBSSH2_ERROR_AGAIN without setting the global session error (yes, that's quite ugly, but it is how the underlying libssh2 works).
flush ( [ ext ] )
Flushes the channel; if ext is present and set, flushes extended data channel. Returns number of bytes flushed, undef on error.
Returns the exit signal of the command executed on the channel. Requires libssh 1.2.8 or higher.
Returns the number of bytes which the remote end may send without overflowing the window limit.
In list context it also returns the number of bytes that are immediately available for read and the size of the initial window.
Returns the number of bytes which may be safely written on the channel without blocking. In list context it also returns the size of the initial window.
receive_window_adjust (adjustment [, force])
Adjust the channel receive window by the given
If the amount to be adjusted is less than
LIBSSH2_CHANNEL_MINADJUST and force is false the adjustment amount will be queued for a later packet.
On success returns the new size of the receive window. On failure it returns undef.
David B. Robins, <firstname.lastname@example.org>
COPYRIGHT AND LICENSE
Copyright (C) 2005, 2006 by David B. Robins; all rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.