Platforms to show: All Mac Windows Linux Cross-Platform

Back to SSH2ChannelMBS class.

SSH2ChannelMBS.Close(Wait as Boolean = true)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Close a channel.

Lasterror is set.
Close an active data channel. In practice this means sending an SSH_MSG_CLOSE packet to the remote host which serves as instruction that no further data will be sent to it. The remote host may still send data back until it sends its own close message in response. To wait for the remote end to close its connection as well, follow this command with WaitClosed.
Lasterror is set to kErrorEAgain when it would otherwise block. While kErrorEAgain is an error, it isn't really a failure per se.

If wait parameter is true, the plugin does a loop to try close until it receives an okay (and not EAGAIN).

SSH2ChannelMBS.Constructor   Private

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The private constructor.

See also:

SSH2ChannelMBS.Constructor(session as SSH2SessionMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 20.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The constructor to create new channel.

May raise UnsupportedOperationException if channel creation fails.

See also:

SSH2ChannelMBS.Destructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The destructor.

SSH2ChannelMBS.EOF as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Check a channel's EOF status.
Example
dim s as string
dim channel as SSH2ChannelMBS // your channel

// read all till end of channel
s = ""
do
app.YieldToNextThread
dim r as string = channel.Read(50000)
s = s + r

if channel.LastError = SSH2SessionMBS.kErrorEagain then
// no answer yet
Continue
elseif channel.LastError = SSH2SessionMBS.kErrorNone then
// we got something
if channel.EOF then
// done?
MsgBox "Result: " + s
exit
end if
else
exit
end if
loop

Check if the remote host has sent an EOF status for the selected stream.
Returns true if the remote host has sent EOF, otherwise false.
Lasterror is set. On error, this function returns true.

SSH2ChannelMBS.Execute(command as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Executes something on the server.

Lasterror is set.
Lasterror is set to kErrorEAgain when it would otherwise block. While kErrorEAgain is an error, it isn't really a failure per se.

SSH2ChannelMBS.Flush

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Flush stream for this channel.

Lasterror is set.

SSH2ChannelMBS.FlushAll

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Flush all streams for this channel.

Lasterror is set.

SSH2ChannelMBS.FlushExtendedData

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Flush extended data stream for this channel.

Lasterror is set.

SSH2ChannelMBS.FlushStdErr

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Flush stderr stream for this channel.

Lasterror is set.

SSH2ChannelMBS.Read(length as Integer = 65536) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Read data from a channel stream.
Example
dim s as string
dim channel as SSH2ChannelMBS // your channel

// read all till end of channel
s = ""
do
app.YieldToNextThread
dim r as string = channel.Read(50000)
s = s + r

if channel.LastError = SSH2SessionMBS.kErrorEagain then
// no answer yet
Continue
elseif channel.LastError = SSH2SessionMBS.kErrorNone then
// we got something
if channel.EOF then
// done?
MsgBox "Result: " + s
exit
end if
else
exit
end if
loop

Lasterror is set.
Attempt to read data from a stdout channel stream.
Returns data read.
Lasterror is set to kErrorEAgain when it would otherwise block. While kErrorEAgain is an error, it isn't really a failure per se.
Version up to 18.2 return text marked as UTF-8, but in 18.3 we change to return text without encoding marking. So if you expect UTF-8, you can apply UTF-8 encoding with DefineEncoding.

SSH2ChannelMBS.ReadStdErr(length as Integer = 65536) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Read data from a channel stream.

Lasterror is set.
Attempt to read data from a stderr channel stream.
Returns data read.
Lasterror is set to kErrorEAgain when it would otherwise block. While kErrorEAgain is an error, it isn't really a failure per se.

Some examples using this method:

SSH2ChannelMBS.RequestPTY(term as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Request a PTY on an established channel.

Lasterror is set.
Note that this does not make sense for all channel types and may be ignored by the server despite returning success.
Lasterror is set to kErrorEAgain when it would otherwise block. While kErrorEAgain is an error, it isn't really a failure per se.

Some examples using this method:

SSH2ChannelMBS.SendEOF

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Send EOF to remote server.

Lasterror is set.
Tell the remote host that no further data will be sent on the specified channel. Processes typically interpret this as a closed stdin descriptor.
Lasterror is set to kErrorEAgain when it would otherwise block. While kErrorEAgain is an error, it isn't really a failure per se.

SSH2ChannelMBS.SetBlocking(blocking as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Set or clear blocking mode on channel.

Some examples using this method:

SSH2ChannelMBS.SetEnv(name as string, value as string)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Set an environment variable on the channel.

Lasterror is set.
Lasterror is set to kErrorEAgain when it would otherwise block. While kErrorEAgain is an error, it isn't really a failure per se.

SSH2ChannelMBS.Shell

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Request a shell on a channel.

Lasterror is set.
Lasterror is set to kErrorEAgain when it would otherwise block. While kErrorEAgain is an error, it isn't really a failure per se.

SSH2ChannelMBS.WaitClosed

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Wait for the remote to close the channel.

Lasterror is set.

Enter a temporary blocking state until the remote host closes the named channel. Typically sent after Close in order to examine the exit status.
Lasterror is set to kErrorEAgain when it would otherwise block. While kErrorEAgain is an error, it isn't really a failure per se.

SSH2ChannelMBS.WaitEOF

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Wait for the remote end to acknowledge an EOF request.

Lasterror is set.
May give kErrorEAgain error which means you should try again later.

SSH2ChannelMBS.Write(data as MemoryBlock) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Write data to a channel stdout stream.

Lasterror is set.

Write functions will use as much as possible of the buffer and put it into a single SSH protocol packet. This means that to get maximum performance when sending larger files, you should try to always pass in at least 32K of data to this function.

Returns actual number of bytes written. Lasterror being kErrorEagain when it would otherwise block. While kErrorEagain is an error, it isn't really a failure per se.

See also:

SSH2ChannelMBS.Write(text as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Write data to a channel stdout stream.

Lasterror is set.

Write functions will use as much as possible of the buffer and put it into a single SSH protocol packet. This means that to get maximum performance when sending larger files, you should try to always pass in at least 32K of data to this function.

Returns actual number of bytes written. Lasterror being kErrorEagain when it would otherwise block. While kErrorEagain is an error, it isn't really a failure per se.

Until version 18.2 we send text as UTF-8. Version 18.3 or newer send bytes as they are in whatever encoding your string has.

See also:

SSH2ChannelMBS.WriteStdErr(data as MemoryBlock) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Write data to a channel stderr stream.

Lasterror is set.

Write functions will use as much as possible of the buffer and put it into a single SSH protocol packet. This means that to get maximum performance when sending larger files, you should try to always pass in at least 32K of data to this function.

Returns actual number of bytes written. Lasterror being kErrorEagain when it would otherwise block. While kErrorEagain is an error, it isn't really a failure per se.

See also:

SSH2ChannelMBS.WriteStdErr(text as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Network MBS Network Plugin 14.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Write data to a channel stderr stream.

Lasterror is set.

Write functions will use as much as possible of the buffer and put it into a single SSH protocol packet. This means that to get maximum performance when sending larger files, you should try to always pass in at least 32K of data to this function.

Returns actual number of bytes written. Lasterror being kErrorEagain when it would otherwise block. While kErrorEagain is an error, it isn't really a failure per se.

Until version 18.2 we send text as UTF-8. Version 18.3 or newer send bytes as they are in whatever encoding your string has.

See also:

The items on this page are in the following plugins: MBS Network Plugin.


The biggest plugin in space...