Contents · Forum Home · StreamSec Tools 4.1.5.363 documentation

SendAllOnChannel

function SendAllOnChannel(const aChannel: iSSHWindowedChannel; const aBuffer : tBytes; aOffset, aCount : Integer; aCancel : PBoolean = nil) : Boolean;
Sends all aCount bytes of aBuffer from aOffset on aChannel, waiting while the peer's window is closed for as long as it takes. The port-forwarding threads send what they read from their TCP connection this way. A channel's own Send stops when the window stays closed for about a second, with the rest of the bytes unsent, and a caller that goes on to its next read loses them.

Only the calling thread may send data on aChannel. It offers no more than the window allows at a time, so Send takes each part whole.

Returns False when it stops early, with part of the bytes possibly sent: aChannel is no longer csConnected (the peer closed it, or it was closed here), aCancel is assigned and aCancel^ became True, or gGlobalCloseAll was set.