sendChannelData method

  1. @override
void sendChannelData(
  1. Uint8List b
)
override

Sends channel data b on sessionChannel. Optionally b is captured by loginPrompts or passwordPrompts.

Implementation

@override
void sendChannelData(Uint8List b) {
  if (loginPrompts != 0) {
    response(this, utf8.decode(b));
    bool cr = b.isNotEmpty && b.last == '\n'.codeUnits[0];
    login += String.fromCharCodes(b, 0, b.length - (cr ? 1 : 0));
    if (cr) {
      response(this, '\n');
      loginPrompts = 0;
      sendAuthenticationRequest();
    }
  } else if (passwordPrompts != 0) {
    bool cr = b.isNotEmpty && b.last == '\n'.codeUnits[0];
    pw = appendUint8List(
        pw ?? Uint8List(0), viewUint8List(b, 0, b.length - (cr ? 1 : 0)));
    if (cr) sendPassword();
  } else {
    if (sessionChannel != null) {
      sendToChannel(sessionChannel, b);
    }
  }
}