Skip to content

Feature Request: Support KeepAlive Option #48

Open
@jooy2

Description

@jooy2

Hello. Thanks for creating & developing the dartssh2 project.

I am developing a terminal app with shell interaction using dartssh2.

Are the KeepAliveInterval and KeepAliveCountMax values configurable via dartssh2 options on the client?

I looked for a similar issue below but couldn't find the answer I was looking for.
#27

If not, hopefully a feature will be added in the future.

Regards,


(Please ignore the problem I had below. It was a hardware issue with my development rig.)

When the SSH connection is completed, the connection is forcibly closed after a certain amount of time with the error below.

(An error is displayed when a key input is attempted after a certain amount of time has elapsed.)

E/flutter (21226): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: SSHStateError(Transport is closed)
E/flutter (21226): #0      SSHTransport.sendPacket (package:dartssh2/src/ssh_transport.dart:183:7)
E/flutter (21226): #1      SSHClient._sendMessage (package:dartssh2/src/ssh_client.dart:460:16)
E/flutter (21226): #2      SSHChannelController._sendEOFIfNeeded (package:dartssh2/src/ssh_channel.dart:269:16)
E/flutter (21226): #3      SSHChannelController.close (package:dartssh2/src/ssh_channel.dart:200:5)
E/flutter (21226): #4      SSHClient._closeChannels (package:dartssh2/src/ssh_client.dart:428:15)
E/flutter (21226): #5      SSHClient._onTransportClosed (package:dartssh2/src/ssh_client.dart:447:5)
E/flutter (21226): #6      new SSHClient.<anonymous closure> (package:dartssh2/src/ssh_client.dart:161:23)
E/flutter (21226): #7      _RootZone.runUnary (dart:async/zone.dart:1653:54)
E/flutter (21226): #8      _FutureListener.handleError (dart:async/future_impl.dart:165:22)
E/flutter (21226): #9      Future._propagateToListeners.handleError (dart:async/future_impl.dart:778:47)
E/flutter (21226): #10     Future._propagateToListeners (dart:async/future_impl.dart:799:13)
E/flutter (21226): #11     Future._completeError (dart:async/future_impl.dart:574:5)
E/flutter (21226): #12     Future._asyncCompleteError.<anonymous closure> (dart:async/future_impl.dart:665:7)
E/flutter (21226): #13     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter (21226): #14     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)

Connection code

connect() async {
    final socket = await SSHSocket.connect('host', 'port');

    _client = SSHClient(
      socket,
      username: 'username',
      onPasswordRequest: () {
        return 'password';
      },
    );

    _shell = await _client.shell();
}

pubspec.yarn

dependencies:
  flutter:
    sdk: flutter

  dartssh2: 2.7.3

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions